diff options
author | Jim McDonald <Jim@mcdee.net> | 2017-12-13 02:47:30 +0800 |
---|---|---|
committer | Jim McDonald <Jim@mcdee.net> | 2017-12-13 02:47:30 +0800 |
commit | 6e521d59b0a30fa0673aaf84559d5b74dbb1eed7 (patch) | |
tree | 618b00999c2de8432f222c7b990f51ef4de6b1f0 /docs/common-patterns.rst | |
parent | 7614b16dc9b2bb1e267e8f46834b40220fb9f9fb (diff) | |
download | dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar.gz dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar.bz2 dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar.lz dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar.xz dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.tar.zst dexon-solidity-6e521d59b0a30fa0673aaf84559d5b74dbb1eed7.zip |
Fix Solidity warnings
Diffstat (limited to 'docs/common-patterns.rst')
-rw-r--r-- | docs/common-patterns.rst | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 52319be0..7e09f534 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -36,12 +36,12 @@ become the new richest. mapping (address => uint) pendingWithdrawals; - function WithdrawalContract() payable { + function WithdrawalContract() public payable { richest = msg.sender; mostSent = msg.value; } - function becomeRichest() payable returns (bool) { + function becomeRichest() public payable returns (bool) { if (msg.value > mostSent) { pendingWithdrawals[richest] += msg.value; richest = msg.sender; @@ -52,7 +52,7 @@ become the new richest. } } - function withdraw() { + function withdraw() public { uint amount = pendingWithdrawals[msg.sender]; // Remember to zero the pending refund before // sending to prevent re-entrancy attacks @@ -71,12 +71,12 @@ This is as opposed to the more intuitive sending pattern: address public richest; uint public mostSent; - function SendContract() payable { + function SendContract() public payable { richest = msg.sender; mostSent = msg.value; } - function becomeRichest() payable returns (bool) { + function becomeRichest() public payable returns (bool) { if (msg.value > mostSent) { // This line can cause problems (explained below). richest.transfer(msg.value); @@ -157,6 +157,7 @@ restrictions highly readable. /// Make `_newOwner` the new owner of this /// contract. function changeOwner(address _newOwner) + public onlyBy(owner) { owner = _newOwner; @@ -171,6 +172,7 @@ restrictions highly readable. /// May only be called 6 weeks after /// the contract has been created. function disown() + public onlyBy(owner) onlyAfter(creationTime + 6 weeks) { @@ -191,6 +193,7 @@ restrictions highly readable. } function forceOwnerChange(address _newOwner) + public costs(200 ether) { owner = _newOwner; @@ -310,6 +313,7 @@ function finishes. // Order of the modifiers matters here! function bid() + public payable timedTransitions atStage(Stages.AcceptingBlindedBids) @@ -318,6 +322,7 @@ function finishes. } function reveal() + public timedTransitions atStage(Stages.RevealBids) { @@ -332,6 +337,7 @@ function finishes. } function g() + public timedTransitions atStage(Stages.AnotherStage) transitionNext @@ -339,6 +345,7 @@ function finishes. } function h() + public timedTransitions atStage(Stages.AreWeDoneYet) transitionNext @@ -346,6 +353,7 @@ function finishes. } function i() + public timedTransitions atStage(Stages.Finished) { |