parent
9eb17cd4a5
commit
c03aae9765
@ -0,0 +1,17 @@ |
||||
pragma solidity ^0.5.0; |
||||
import "./mortal.sol"; |
||||
|
||||
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; |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
pragma solidity ^0.5.0; |
||||
|
||||
contract Mortal { |
||||
/* Define variable owner of the type address */ |
||||
address payable owner; |
||||
|
||||
/* This function is executed at initialization and sets the owner of the contract */ |
||||
function mortal() public { owner = msg.sender; } |
||||
|
||||
/* Function to recover the funds on the contract */ |
||||
function kill() public { if (msg.sender == owner) selfdestruct(owner); } |
||||
} |
Loading…
Reference in new issue