Search code examples
pythonsolidity

Remix IDE - No store or retrieve button after Compilation


I am busy teaching myself solidity via Patrick Collins instruction video When entering store in SimpleStorage.sol as per video instruction it does not turn green as in the video. It stays white. Same for retrieve function.

When compiling no store(orange) or retrieve(blue) buttons get displayed.

Can someone please explain why?

Code below

pragma solidity ^0.6.0;

contract SimpleStorage {

uint256 public favouriteNumber;

function store(unit256 _favouriteNumber) public {
    favouriteNumber = _favouriteNumber;
}

function retrieve() public view returns(unit256) {
    return favouriteNumber;
}

}

Messages displayed

SimpleStorage.sol:9:20: DeclarationError: Identifier not found or not unique. function store(unit256 _favouriteNumber) public { ^-----^

SimpleStorage.sol:13:45: DeclarationError: Identifier not found or not unique. function retrieve() public view returns(unit256) { ^-----^


Solution

  • You've got a typo in both your store and retrieve function. Instead of uint256 you've written unit256.

    Both of your errors are DeclarationErrors, and as the name implies, it means that Solidity didn't recognize the data type you tried to use (in this case, uint256). A good (very cursory) way of preventing typos in the future would be to see if the keyword you just typed is the right color in your editor.

    Best of luck!