const issueToken = async (to, numberOfCoins) => {
console.log(await TOKEN_CONTRACT.methods.balanceOf(to).call());
const numberOfCoinsWithDecimals = web3.utils.toWei(numberOfCoins.toString(), “ether”);
const tx = TOKEN_CONTRACT.methods.transfer(to, numberOfCoinsWithDecimals);
console.log(web3.eth.accounts.wallet);
const receipt = await tx.send({
from: signer.address,
gas: await tx.estimateGas()
}).once(“transactionHash”, (txhash) => {
console.log(Mining transaction ...
);
console.log(https://${network}.etherscan.io/tx/${txhash}
);
});
// The transaction is now on chain!
console.log(Mined in block ${receipt.blockNumber}
);}
Using above function I am trying to send Tokens from the master account to the to
account, however, I keep on getting this error from the ERC20 contract that: Error: Returned error: execution reverted: ERC20: transfer from the zero address
This fails when the sender is address(zero), however, I have cross checked twice or thrice that the signer is not an empty object, still I am not able to figure out why the from part is going as address(zero)
With demo-ethx -> web3/call.js the same code has been used to send transaction, there it works, however in my case it fails
Any help would be much appreciated. Thank You.