Use the storage keyword in examples

This commit is contained in:
Alex Beregszaszi 2017-07-26 14:47:03 +01:00
parent 6eaf17db38
commit 48a15ea19d
2 changed files with 4 additions and 4 deletions

View File

@ -101,7 +101,7 @@ of votes.
/// Delegate your vote to the voter `to`.
function delegate(address to) {
// assigns reference
Voter sender = voters[msg.sender];
Voter storage sender = voters[msg.sender];
require(!sender.voted);
// Self-delegation is not allowed.
@ -141,7 +141,7 @@ of votes.
/// Give your vote (including votes delegated to you)
/// to proposal `proposals[proposal].name`.
function vote(uint proposal) {
Voter sender = voters[msg.sender];
Voter storage sender = voters[msg.sender];
require(!sender.voted);
sender.voted = true;
sender.vote = proposal;

View File

@ -743,7 +743,7 @@ shown in the following example:
}
function contribute(uint campaignID) payable {
Campaign c = campaigns[campaignID];
Campaign storage c = campaigns[campaignID];
// Creates a new temporary memory struct, initialised with the given values
// and copies it over to storage.
// Note that you can also use Funder(msg.sender, msg.value) to initialise.
@ -752,7 +752,7 @@ shown in the following example:
}
function checkGoalReached(uint campaignID) returns (bool reached) {
Campaign c = campaigns[campaignID];
Campaign storage c = campaigns[campaignID];
if (c.amount < c.fundingGoal)
return false;
uint amount = c.amount;