1

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;
1

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
    Thank you! Much appreciated! I will try to format code snippet next time! – Z0rlord Jul 1 '18 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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.