Skip to content

Instantly share code, notes, and snippets.

@danielmcclure
Created December 8, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielmcclure/4fb728de86f956ae53327da2b2b4bc8d to your computer and use it in GitHub Desktop.
Save danielmcclure/4fb728de86f956ae53327da2b2b4bc8d to your computer and use it in GitHub Desktop.
Ethereum Greeter Updated from v4
pragma solidity ^0.5.0;
contract mortal {
/* Define variable owner of the type address */
address owner;
/* This function is executed at initialisation and sets the owner of the contract */
constructor() public { owner = msg.sender; }
/* Function to recover the funds of the contract */
function kill() public { if (msg.sender == owner) selfdestruct(msg.sender); }
}
contract greeter is mortal {
/* Define variable greeting of the type string */
string greeting;
/* This runs when the contract is executed */
constructor(string memory _greeting) public {
greeting = _greeting;
}
/* Main Function */
function greet() public view returns (string memory) {
return greeting;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment