Skip to content

Instantly share code, notes, and snippets.

@EdsonAlcala
Created November 8, 2019 15:39
Show Gist options
  • Save EdsonAlcala/9f0cfc512166d4c0a583b1f58fa18e21 to your computer and use it in GitHub Desktop.
Save EdsonAlcala/9f0cfc512166d4c0a583b1f58fa18e21 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.3;
contract SimpleStorage {
function getValue() public pure returns(uint256){
uint256 value = 1000;
return value;
}
}
pragma solidity ^0.5.3;
contract SimpleStorage {
uint256 value;
constructor() public {
value = 1000;
}
function getValue() public view returns(uint256){
return value;
}
}
pragma solidity ^0.5.3;
contract SimpleStorage {
uint256 value;
constructor() public {
value = 1000;
}
function getValue() public view returns(uint256){
return value;
}
function setValue(uint256 _newValue) public {
value = _newValue;
}
}
pragma solidity ^0.5.3;
contract SimpleStorage {
uint256 value;
address owner;
constructor() public {
value = 1000;
owner = msg.sender;
}
function getValue() public view returns(uint256){
return value;
}
function setValue(uint256 _newValue) public {
require(owner == msg.sender, 'Only owner can set value');
value = _newValue;
}
}
pragma solidity ^0.5.3;
contract PromiseContract {
string promiseValue;
address owner;
address friend;
constructor() public {
owner = msg.sender;
friend = 0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C; // TODO Replace with the address of your friend
}
function whatIsThePromise() public view returns(string memory){
return promiseValue;
}
function makePromise(string memory _promise) public {
require(friend == msg.sender, 'Only a friend can make a promise');
promiseValue = _promise;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment