aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-28 19:14:41 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-28 19:14:41 +0800
commit550d646b9727603f39aeaa432d718cd2bb51cf85 (patch)
treede0c3453c5184075f26d86ca9158dfbd2e800123 /docs
parent5a5d21d0c8d24ca8a6685d023cf07b2d586addcd (diff)
downloaddexon-solidity-550d646b9727603f39aeaa432d718cd2bb51cf85.tar.gz
dexon-solidity-550d646b9727603f39aeaa432d718cd2bb51cf85.tar.zst
dexon-solidity-550d646b9727603f39aeaa432d718cd2bb51cf85.zip
Explain safe purchase (even number)
Diffstat (limited to 'docs')
-rw-r--r--docs/solidity-by-example.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index ca6b970c..139c8a42 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -535,6 +535,9 @@ Safe Remote Purchase
enum State { Created, Locked, Inactive }
State public state;
+ // Ensure that `msg.value` is an even number.
+ // Division will truncate if it is an odd number.
+ // Check via multiplication that it wasn't an odd number.
function Purchase() payable {
seller = msg.sender;
value = msg.value / 2;