0

Here is my contract:

    constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) { }

    function giveMePaisa() public {
        _mint(msg.sender, 10 * 10 ** 18);
    }
}

From Hardhat console testing ... I am able to successfully transfer my custom Tokens to test accounts:

await meraToken.connect(addr2).giveMePaisa();

But, when I try to see my custom tokens ...

await ethers.provider.getBalance(addr2.address);

I see ( which I assume are Ethers ) :

BigNumber { value: "9999999976573474278440" }

How can I see my custom tokens from Hardhat console ?

2

1 Answer 1

1

ethers.provider.getBalance(addr2.address);

Will fetch you the Ethereum balance of the addr2.address, what you need to do is call balanceOf on the meraToken contract with addr2.address as parameter.

await meraToken.balanceOf(addr2.address);

Hope that helps

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.