-1

After reading documentation online, I can tell something isn't clicking for me when it comes to dealing with ERC20 tokens in Solidity.

At the very basic level, I need this contract to be able to transfer HEX, an ERC20 token, from user to user. I deploy the contract to the Pulsechain Testnet through Injected Web3.

Here's the main contract

This is how I implement ERC functionality

This is what the function looks like before I call it. Below you can clearly see that the account about to call the transfer() function has enough HEX for the transaction

However, this is the error message I get

If there's an easier way to transfer ERC20 tokens please let me know, or if someone has any helpful learning resources I would seriously appreciate it. All the videos I've tried to watch just cover creating your own ERC20 token.

hcwil
  • 59
  • 1
  • 5
  • If you want help you should explain your problem with the code in this post. Nobody is going to go throgh your links and try to figure out your problem. – Kuly14 Feb 17 '22 at 10:26

1 Answers1

0

The contract doesn't state that you have any balance, so it leads to the tranfer error.

Given you state the balance in your token.sol, you will not able to do the transfer using the ERC functional contract, unless you approve it.

One more thing, the token is abstract, you should make it contract, not abstract.

PySoL
  • 566
  • 3
  • 9