Skip to content

Instantly share code, notes, and snippets.

@StefH
Created May 22, 2019 05:54
Show Gist options
  • Save StefH/97f306be11e906c5fce3aa3b99d79eb5 to your computer and use it in GitHub Desktop.
Save StefH/97f306be11e906c5fce3aa3b99d79eb5 to your computer and use it in GitHub Desktop.
SimpleStorage SmartContract
pragma solidity >=0.5.2 <0.6.0;
contract SimpleStorageContract {
int private _version;
string private _description;
uint private _storedNumber;
string private _storedString;
constructor (int version, string memory description) public {
_version = version;
_description = description;
}
function setNumber(uint value) public {
if (value < 10) {
_storedNumber = 1;
} else {
_storedNumber = value;
}
}
function getNumber() public view returns (uint) {
return _storedNumber;
}
function setString(string memory value) public {
_storedString = value;
}
function getString() public view returns (string memory) {
return _storedString;
}
function getVersion() public view returns (int version, string memory description) {
return (_version, _description);
}
function addNumbers(uint number1, uint number2) public pure returns (uint) {
return number1 + number2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment