mintTokens.js 638 B

123456789101112131415
  1. task("mintTokens", "mint tokens to an address if it has a mint() function")
  2. .addParam("token", "the token address")
  3. .addParam("addr", "mint to this address")
  4. .addParam("qty", "the the qty to mint")
  5. .setAction(async (taskArgs) => {
  6. let accounts = await ethers.getSigners()
  7. let owner = accounts[0] // me
  8. console.log(`owner: ${owner.address}`)
  9. let MockToken = await ethers.getContractFactory("MockToken")
  10. let mockToken = await MockToken.attach(taskArgs.token)
  11. let tx = await mockToken.mint(taskArgs.addr, taskArgs.qty)
  12. console.log(`tx: ${JSON.stringify(tx)}`)
  13. })