Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2018 20:49
What would you like to do?
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