account.js 435 B

1234567891011121314
  1. const { ethers } = require('hardhat');
  2. const { impersonateAccount, setBalance } = require('@nomicfoundation/hardhat-network-helpers');
  3. // Hardhat default balance
  4. const DEFAULT_BALANCE = 10000n * ethers.WeiPerEther;
  5. const impersonate = (account, balance = DEFAULT_BALANCE) =>
  6. impersonateAccount(account)
  7. .then(() => setBalance(account, balance))
  8. .then(() => ethers.getSigner(account));
  9. module.exports = {
  10. impersonate,
  11. };