0
pragma solidity ^0.5.1;

contract owner {
    address public owner;

    function owned() public {
        owner = msg.sender;
    }

    function set( string memory _data) public {
        data = _data;
    }


modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

function transferOwnership(address newOwner) onlyOwner public {
        owner = newOwner;
    }
}

interface tokenRecipient { function receiveApproval( address  _from, uint256  _value,  address _token, bytes _extradata) public; }
  • There is no data variable in your code. Before jumping to creating a cryptocurrency, I recommend that you first study the basic concepts of programming. – goodvibration May 26 at 8:25
  • I copied the code from a youtube video but it was before version 0.5.0. I just attempted to add where the memory went as required by watching newer videos on coding but unfortunately I still dont really know what im doing. – Semiserious May 26 at 8:37
  • It doesn't have anything to do with compiler version. If a variable is used before being declared, then the code will not compile. This one is true for any strongly-typed language, not just Solidity (which is why I suggested that you learned some basic concepts first). – goodvibration May 26 at 8:40
  • alright thanks for the help, ill try to look into basic concepts first before trying anything else. If you have any links that could help that would be great. – Semiserious May 26 at 8:49

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.