Skip to content

Instantly share code, notes, and snippets.

@EdsonAlcala
Forked from defiboy/Exercise1.sol
Created November 8, 2019 15:33
Show Gist options
  • Save EdsonAlcala/58216ebab46a0b95bb47db644fa39b61 to your computer and use it in GitHub Desktop.
Save EdsonAlcala/58216ebab46a0b95bb47db644fa39b61 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