From 6e730df036f6672e07cf96189a8cf721bf7d0cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20R=C3=A9=20Medina?= Date: Mon, 19 Mar 2018 16:38:20 -0300 Subject: Fix: Missing payable at function forceOwnerChange forceOwnerChange expects ether, and does not have the payable keyword. --- docs/common-patterns.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/common-patterns.rst') diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 7e09f534..c62b5aca 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -194,6 +194,7 @@ restrictions highly readable. function forceOwnerChange(address _newOwner) public + payable costs(200 ether) { owner = _newOwner; -- cgit v1.2.3 From 344a388d4461abd7369ea44b123f5afe549dc8f7 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 3 Jan 2018 15:30:01 +0100 Subject: Update documentation. --- docs/common-patterns.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'docs/common-patterns.rst') diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index c62b5aca..233bdc4e 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -147,7 +147,10 @@ restrictions highly readable. // a certain address. modifier onlyBy(address _account) { - require(msg.sender == _account); + require( + msg.sender == _account, + "Sender not authorized." + ); // Do not forget the "_;"! It will // be replaced by the actual function // body when the modifier is used. @@ -164,7 +167,10 @@ restrictions highly readable. } modifier onlyAfter(uint _time) { - require(now >= _time); + require( + now >= _time, + "Function called too early." + ); _; } @@ -186,7 +192,10 @@ restrictions highly readable. // This was dangerous before Solidity version 0.4.0, // where it was possible to skip the part after `_;`. modifier costs(uint _amount) { - require(msg.value >= _amount); + require( + msg.value >= _amount, + "Not enough Ether provided." + ); _; if (msg.value > _amount) msg.sender.send(msg.value - _amount); @@ -290,7 +299,10 @@ function finishes. uint public creationTime = now; modifier atStage(Stages _stage) { - require(stage == _stage); + require( + stage == _stage, + "Function cannot be called at this time." + ); _; } -- cgit v1.2.3 From 8a7224683b8fbf7c822922dca35ee2eda8e41d79 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Sun, 15 Apr 2018 23:12:28 +0200 Subject: Docs: Update solidity version for revert with reason --- docs/common-patterns.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/common-patterns.rst') diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 233bdc4e..739e136f 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -130,7 +130,7 @@ restrictions highly readable. :: - pragma solidity ^0.4.11; + pragma solidity ^0.4.22; contract AccessRestriction { // These will be assigned at the construction @@ -282,7 +282,7 @@ function finishes. :: - pragma solidity ^0.4.11; + pragma solidity ^0.4.22; contract StateMachine { enum Stages { -- cgit v1.2.3