1

I am trying to mint a ERC-20 token here. I have compiled the smart contract. While trying to run I get this error: TypeError: Cannot read properties of null (reading 'sendTransaction')

Token.sol:

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract DevToken is ERC20{
    constructor(uint256 totalSupply) ERC20("Gabby", "GB"){
        _mint(msg.sender, totalSupply);
    }
}

deploy.js

const hre = require("hardhat");

async function main() {
  const DevToken = await hre.ethers.getContractFactory("DevToken");
  const devToken = await DevToken.deploy("1000000000000000000000000000");

  await devToken.deployed();

  console.log("Token deployed to:", devToken.address);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

1 Answer 1

0

check your config file. Your code is working fine at my end :)

1
  • Yes had issue with the url in hardhat.config.js . Thank you Commented Oct 7, 2022 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.