How to use the hardhat.network.provider function in hardhat

To help you get started, we’ve selected a few hardhat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cosmos / gravity-bridge / solidity / tests_mainnet_fork / uniswap-logic.ts View on Github external
async function runTest() {
  //Take over the largest liquidity provider for USDC

  await network.provider.request({
    method: "hardhat_impersonateAccount",
    params: ["0x0c731fb0d03211dd32a456370ad2ec3ffad46520"],
  });

  let lp_signer = await ethers.provider.getSigner(
    "0x0c731fb0d03211dd32a456370ad2ec3ffad46520"
  );

  let starting_lp_eth_balance = await ethers.provider.getBalance(await lp_signer.getAddress());

  console.log(`Starting LP eth balance ${starting_lp_eth_balance}`);

  let uniswap_router_address = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";

  let uniswap_router_contact = await IUniswapV2Pair__factory.connect(uniswap_router_address,lp_signer);