diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-26 21:47:03 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-27 06:05:09 +0800 |
commit | 48a15ea19d74fb639b1b7e8a47b420f896857712 (patch) | |
tree | 5b1842fc698bbc42637e710f7d5ccd748b32798e | |
parent | 6eaf17db38e82a6c26fe63cd0eb715243efc5c70 (diff) | |
download | dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar.gz dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar.bz2 dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar.lz dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar.xz dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.tar.zst dexon-solidity-48a15ea19d74fb639b1b7e8a47b420f896857712.zip |
Use the storage keyword in examples
-rw-r--r-- | docs/solidity-by-example.rst | 4 | ||||
-rw-r--r-- | docs/types.rst | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index ddbca471..79eafd06 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -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; diff --git a/docs/types.rst b/docs/types.rst index 66dfc627..dd9c6269 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -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; |