mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use the storage keyword in examples
This commit is contained in:
parent
6eaf17db38
commit
48a15ea19d
@ -101,7 +101,7 @@ of votes.
|
|||||||
/// Delegate your vote to the voter `to`.
|
/// Delegate your vote to the voter `to`.
|
||||||
function delegate(address to) {
|
function delegate(address to) {
|
||||||
// assigns reference
|
// assigns reference
|
||||||
Voter sender = voters[msg.sender];
|
Voter storage sender = voters[msg.sender];
|
||||||
require(!sender.voted);
|
require(!sender.voted);
|
||||||
|
|
||||||
// Self-delegation is not allowed.
|
// Self-delegation is not allowed.
|
||||||
@ -141,7 +141,7 @@ of votes.
|
|||||||
/// Give your vote (including votes delegated to you)
|
/// Give your vote (including votes delegated to you)
|
||||||
/// to proposal `proposals[proposal].name`.
|
/// to proposal `proposals[proposal].name`.
|
||||||
function vote(uint proposal) {
|
function vote(uint proposal) {
|
||||||
Voter sender = voters[msg.sender];
|
Voter storage sender = voters[msg.sender];
|
||||||
require(!sender.voted);
|
require(!sender.voted);
|
||||||
sender.voted = true;
|
sender.voted = true;
|
||||||
sender.vote = proposal;
|
sender.vote = proposal;
|
||||||
|
@ -743,7 +743,7 @@ shown in the following example:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function contribute(uint campaignID) payable {
|
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
|
// Creates a new temporary memory struct, initialised with the given values
|
||||||
// and copies it over to storage.
|
// and copies it over to storage.
|
||||||
// Note that you can also use Funder(msg.sender, msg.value) to initialise.
|
// 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) {
|
function checkGoalReached(uint campaignID) returns (bool reached) {
|
||||||
Campaign c = campaigns[campaignID];
|
Campaign storage c = campaigns[campaignID];
|
||||||
if (c.amount < c.fundingGoal)
|
if (c.amount < c.fundingGoal)
|
||||||
return false;
|
return false;
|
||||||
uint amount = c.amount;
|
uint amount = c.amount;
|
||||||
|
Loading…
Reference in New Issue
Block a user