diff --git a/src/main/solidity/greeter/Greeter.sol b/src/main/solidity/greeter/Greeter.sol index 2a2ea98..38c98d0 100644 --- a/src/main/solidity/greeter/Greeter.sol +++ b/src/main/solidity/greeter/Greeter.sol @@ -1,40 +1,38 @@ -pragma solidity ^0.4.25; - -// Modified Greeter contract. Based on example at https://www.ethereum.org/greeter. +pragma solidity >=0.4.22 <0.6.0; contract Mortal { - /* Define variable owner of the type address*/ + /* 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; } + /* This constructor 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); } + function kill() public { if (msg.sender == owner) selfdestruct(msg.sender); } } contract Greeter is Mortal { - /* define variable greeting of the type string */ + /* Define variable greeting of the type string */ string greeting; - /* this runs when the contract is executed */ - constructor (string _greeting) public { + /* This runs when the contract is executed */ + constructor(string memory _greeting) public { greeting = _greeting; } - function newGreeting(string _greeting) public { + function newGreeting(string memory _greeting) public { emit Modified(greeting, _greeting, greeting, _greeting); greeting = _greeting; } - /* main function */ - function greet() public constant returns (string) { + /* Main function */ + function greet() public view returns (string memory) { return greeting; } /* we include indexed events to demonstrate the difference that can be - captured versus non-indexed */ +captured versus non-indexed */ event Modified( - string indexed oldGreetingIdx, string indexed newGreetingIdx, - string oldGreeting, string newGreeting); -} + string indexed oldGreetingIdx, string indexed newGreetingIdx, + string oldGreeting, string newGreeting); +} \ No newline at end of file