3

Any help much appreciated!

getting error on "string public "Test Token";" line

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }

contract TokenERC20 {
    // Public variables of the token
    string public "Test Token";
    string public "TEST";
    uint8 public decimals = 18;
    // 18 decimals is the strongly suggested default, avoid changing it
    uint256 public 100000000;

2 Answers 2

2

You are missing variables names for "Test Token" and "TEST" strings.

This will work.

pragma solidity ^0.4.16;

interface tokenRecipient { 

    function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; 

}

contract TokenERC20 {
    // Public variables of the token 
    string public name = "Test Token"; 
    string public name2 =  "TEST"; 
    uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public 100000000;
}

Next time please try to format your code snippet when asking question. It is easier to read. Thanks :)

1
  • 1
    Thank you! Much appreciated! I will try to format code snippet next time!
    – Z0rlord
    Commented Jul 1, 2018 at 16:54
1

No variable names are declared as of your code. That's only is the problem, solidity need some variable name to store a string or whatever it is

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }

contract TokenERC20 {
   // Public variables of the token
   string public testToken = "Test Token";
   string public test = "TEST";
   uint8 public decimals = 18;
   // 18 decimals is the strongly suggested default, avoid changing it
uint256 public bigNumber = 100000000;

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.