Hello. I use Hardhat fork in mainet, I need to get USDC but I don't understand how.
There was an unlock command in ganache-cli. Is there something like that in Hardhat so that you can use strony addresses?
May 1, 2021, 6:55 AM
Probably the easiest is to get yourself Ethers and then trade in Uniswap. Or to find an account which has what you need and impersonate that
May 1, 2021, 7:24 AM
Thank you
Sorry if this is a stupid question, I understood this option correctly.
to use "hardhat_stopImpersonatingAccount"
It is necessary to run
"npx hardhat node --fork https: //mainnet.infura"
and deploy like this.
async function main () {
const Main = await hre.ethers.getContractFactory ("Main");
const main = await Main.deploy ();
await main.deployed ();
await hre.network.provider.request ({
method: "hardhat_stopImpersonatingAccount",
params: ["0xF977814e90dA44bFA03b6295A0616a897441aceC"]}
)
console.log ("Greeter deployed to:", main.address);
}
main ()
.then (() => process.exit (0))
.catch (error => {
console.error (error);
process.exit (1);
});
to use "hardhat_stopImpersonatingAccount"
It is necessary to run
"npx hardhat node --fork https: //mainnet.infura"
and deploy like this.
async function main () {
const Main = await hre.ethers.getContractFactory ("Main");
const main = await Main.deploy ();
await main.deployed ();
await hre.network.provider.request ({
method: "hardhat_stopImpersonatingAccount",
params: ["0xF977814e90dA44bFA03b6295A0616a897441aceC"]}
)
console.log ("Greeter deployed to:", main.address);
}
main ()
.then (() => process.exit (0))
.catch (error => {
console.error (error);
process.exit (1);
});
May 1, 2021, 9:18 AM