How to use the hardhat.ethers.getSigners 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
let lp_balance_to_send = 2_000_000_000_000;

  let eth_per_lp_unit = reserve1.div(total_lp_supply); 

  console.log(`Eth per lp token:${eth_per_lp_unit}`)

  // USDC ethereum address
  let usdc_address = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";

  let wrapped_eth_address ="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";


  // Prep and deploy contract
  // ========================
  const signers = await ethers.getSigners();
  const gravityId = ethers.utils.formatBytes32String("foo");
  // This is the power distribution on the Cosmos hub as of 7/14/2020
  let powers = examplePowers();
  let validators = signers.slice(0, powers.length);
  const powerThreshold = 6666;
  const {
    gravity,
    testERC20,
    checkpoint: deployCheckpoint,
  } = await deployContracts(gravityId, validators, powers, powerThreshold);

  // First we deploy the logic batch middleware contract. This makes it easy to call a logic
  // contract a bunch of times in a batch.
  const SimpleLogicBatchMiddleware = await ethers.getContractFactory(
    "SimpleLogicBatchMiddleware"
  );
github OffchainLabs / arbitrum / packages / arb-bridge-peripherals / scripts / deploy_token_bridge_l2.ts View on Github external
const main = async () => {
  const accounts = await ethers.getSigners()
  const StandardArbERC20 = await ethers.getContractFactory('StandardArbERC20')
  const StandardArbERC777 = await ethers.getContractFactory('StandardArbERC777')

  const standardArbERC20Logic = await StandardArbERC20.deploy()
  await standardArbERC20Logic.deployed()
  console.log(`erc20 logic at ${standardArbERC20Logic.address}`)

  const standardArbERC777Logic = await StandardArbERC777.deploy()
  await standardArbERC777Logic.deployed()
  console.log(`erc777 logic at ${standardArbERC777Logic.address}`)

  // const ProxyAdmin = await ethers.getContractFactory('ProxyAdmin')
  // const proxyAdmin = await ProxyAdmin.deploy()
  // await proxyAdmin.deployed()
  // console.log("Admin proxy deployed to", proxyAdmin.address)
github ethereum-optimism / optimism / packages / contracts / deploy / 018-fund-accounts.ts View on Github external
const deployFn: DeployFunction = async (hre) => {
  const { deployer } = await hre.getNamedAccounts()

   // Fund all default hardhat signers  with ETH if deploying on a local hardhat network
   const { chainId } = await ethers.provider.getNetwork()
   if (chainId === 31337) {
     const Proxy__OVM_L1ETHGateway = await getDeployedContract(
       hre,
       'Proxy__OVM_L1ETHGateway',
       {
         signerOrProvider: deployer,
         iface: 'OVM_L1ETHGateway',
       }
     )
     const signers = await ethers.getSigners()
     for (const signer of signers) {
       const to = await signer.getAddress()
       const l2gas = 8_000_000
       const amount = '100'
       const value = ethers.utils.parseEther(amount)
       await Proxy__OVM_L1ETHGateway.depositTo(to, l2gas, '0x', { value })
       console.log(`✓ Funded ${to} on L2 with ${amount} ETH`)
     }
   }
}
github OffchainLabs / arbitrum / packages / arb-bridge-peripherals / scripts / deploy.ts View on Github external
const main = async () => {
  const accounts = await ethers.getSigners()

  const SymmetricBridge = await ethers.getContractFactory(
    'ArbSymmetricTokenBridge'
  )
  const symmetricBridge = await SymmetricBridge.deploy()

  console.log('ArbSymmetricTokenBridge deployed to:', symmetricBridge.address)

  await deploy1820Registry(accounts[0])
}
github OffchainLabs / arbitrum / packages / arb-bridge-eth / scripts / upgrade.ts View on Github external
async function main() {
  const accounts = await ethers.getSigners()

  const rollupCreator = RollupCreator__factory.connect(
    prevAddresses.rollupCreator,
    ethers.provider
  )

  const rollupCreatorOwner = await rollupCreator.owner()
  if (accounts[0].address.toLowerCase() !== rollupCreatorOwner.toLowerCase()) {
    throw new Error('Current account must be rollup creator owner')
  }

  const linkedBridgeCreator = await rollupCreator.bridgeCreator()
  const linkedRollupTemplate = await rollupCreator.rollupTemplate()
  const linkedChallengeFactory = await rollupCreator.challengeFactory()
  const linkedNodeFactory = await rollupCreator.nodeFactory()
github OffchainLabs / arbitrum / packages / arb-bridge-peripherals / scripts / deploy_token_bridge_l1.ts View on Github external
const main = async () => {
  const accounts = await ethers.getSigners()

  const inboxAddress =
    process.env.INBOX_ADDRESS || '0xD71d47AD1b63981E9dB8e4A78C0b30170da8a601'

  if (inboxAddress === '' || inboxAddress === undefined)
    throw new Error('Please set inbox address! INBOX_ADDRESS')

  const EthERC20Bridge = await ethers.getContractFactory('EthERC20Bridge')

  if (
    deployments.buddyDeployer === '' ||
    deployments.standardArbERC20 === '' ||
    deployments.standardArbERC777 === ''
  )
    throw new Error("Deployments.json doesn't include the necessary addresses")