Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#8) replace constant modifier by view in 05 and 20 #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/05_greeter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ contract Greeter {
greeting = _greeting;
}

function greet() public constant returns (string) {
function greet() public view returns (string) {
return greeting;
}

// this doesn't have anything to do with the act of greeting
// just demonstrating return of some global variable
function getBlockNumber() public constant returns (uint) {
function getBlockNumber() public view returns (uint) {
return block.number;
}

Expand Down
28 changes: 15 additions & 13 deletions contracts/20_value_incrementer.sol
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
// This contract demonstrates a simple non-constant (transactional) function you can call from geth.
// increment() takes no parameters and merely increments the "iteration" value.
// increment() takes no parameters and merely increments the "iteration" value.

pragma solidity ^0.4.23;

contract Incrementer {

address creator;
uint iteration;

function Incrementer() public
function Incrementer() public
{
creator = msg.sender;
creator = msg.sender;
iteration = 0;
}

function increment()
function increment()
{
iteration = iteration + 1;
}
function getIteration() constant returns (uint)

function getIteration() view returns (uint)
{
return iteration;
}

/**********
Standard kill() function to recover funds
Standard kill() function to recover funds
**********/
function kill()
{

function kill()
{
if (msg.sender == creator)
suicide(creator); // kills this contract and sends remaining funds back to creator
}
}

}