Skip to content

Instantly share code, notes, and snippets.

@treeder
Created June 21, 2018 19:17
Show Gist options
  • Select an option

  • Save treeder/ef3fe19eeab96b4c0a03854b557ddf1d to your computer and use it in GitHub Desktop.

Select an option

Save treeder/ef3fe19eeab96b4c0a03854b557ddf1d to your computer and use it in GitHub Desktop.

Revisions

  1. treeder created this gist Jun 21, 2018.
    27 changes: 27 additions & 0 deletions greeter.sol
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    pragma solidity ^0.4.21;

    contract Mortal {
    /* Define variable owner of the type address */
    address owner;

    /* This function is executed at initialization and sets the owner of the contract */
    constructor() public { owner = msg.sender; }

    /* Function to recover the funds on the contract */
    function kill() public { if (msg.sender == owner) selfdestruct(owner); }
    }

    contract Greeter is Mortal {
    /* Define variable greeting of the type string */
    string greeting;

    /* This runs when the contract is executed */
    constructor() public {
    greeting = "Hello World!";
    }

    /* Main function */
    function greet() public view returns (string) {
    return greeting;
    }
    }