0

I successfully deployed to ROPSTEN a very simple ERC20 Token Contract - the code for which I copy-pasted from OpenZeppelin's GitHub repo.

-I used remix to do this (see screengrab below)

-I'm 99.9% sure the code is perfectly fine because it's from OpenZeppelin - plus, as mentioned, the compilation & deployment went smoothly and without errors.

However, every time I try to do a simple Token Transfer from one account to another using the contract's transfer function, a window pops up with the following warning:

0xA9c2066BE0c0bBcCdd84Cd7A689277a64624ea61

If I go on and tap on the "Send Transaction" button anyway, I do indeed get an error - and the transfer fails.

Checking the transaction on etherscan.io, it looks like this:

enter image description here


My question is simply this: what's going on? I did everything correctly - why can't I do a simple transfer?

(The contract is sitting on Ropsten at the following address: 0xdce9f7c049d37414da4a3b4d11f8d1618b2c6dcc)

Here's what my Remix window is looking like:

enter image description here

And here's the Contract Code:

pragma solidity ^0.4.24;

import "./ERC20.sol";

/**
 * @title SimpleToken
 * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
 * Note they can later distribute these tokens as they wish using `transfer` and other
 * `ERC20` functions.
 */

contract POPCoin is ERC20 {

  string public constant name = "POPCoin";
  string public constant symbol = "POPC";
  uint8 public constant decimals = 3;
  uint256 public actualNumber = 0;

  uint256 public constant INITIAL_SUPPLY = 100000000 * (10 ** uint256(decimals));

  /**
   * @dev Constructor that gives msg.sender all of existing tokens.
   */
  constructor() public {
    _mint(msg.sender, INITIAL_SUPPLY);
    actualNumber = INITIAL_SUPPLY / (10 ** uint256(decimals));
  }

}
  • Check first the balance of the account you are using to transfer. Have you enough token on that? – Rick Park Jan 26 at 23:42
  • yeah, I also thought of that, and I did check - I've got 0.9921 ETH. That's enough, right? (I mean the funny this is that I don't even know what a sufficient amount would be for testing.) – Sirab33 Jan 26 at 23:45
  • I just went to the Ropsten faucet and got another ETH, so I now have 1.9921 ETH. I'll give the whole thing another try, see if that makes a difference... – Sirab33 Jan 26 at 23:49
  • That didn't work. So I went ahead and deleted the Contract from Ropsten, then redeployed it - and now it IS working. – Sirab33 Jan 26 at 23:57
  • 🤷‍♂️ (but thank you! - will give you credit for providing the right answer.) – Sirab33 Jan 26 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.