aboutsummaryrefslogtreecommitdiffstats
path: root/docs/types.rst
diff options
context:
space:
mode:
authorChris Ward <chriswhward@gmail.com>2018-07-18 23:03:30 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-08-03 21:09:42 +0800
commit22a2f5dd1d22fa7577278883cfd9c2f96c152c28 (patch)
tree4e582f0f30a618b0ed58b1b7acf7e6a415cec67e /docs/types.rst
parentda6cefd475210a9bcae0aad80c03f3679ae00f56 (diff)
downloaddexon-solidity-22a2f5dd1d22fa7577278883cfd9c2f96c152c28.tar.gz
dexon-solidity-22a2f5dd1d22fa7577278883cfd9c2f96c152c28.tar.zst
dexon-solidity-22a2f5dd1d22fa7577278883cfd9c2f96c152c28.zip
Clarify truncation with addresses
Diffstat (limited to 'docs/types.rst')
-rw-r--r--docs/types.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 566c4c19..fbc83972 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -104,6 +104,14 @@ Operators:
* ``<=``, ``<``, ``==``, ``!=``, ``>=`` and ``>``
+.. warning::
+ If you convert a type that uses a larger byte size to an ``address``, for example ``bytes32``, then the ``address`` is truncated.
+ To reduce conversion ambiguity version 0.4.24 and higher of the compiler force you make the truncation explicit in the conversion.
+ Take for example the address ``0x111122223333444455556666777788889999AAAABBBBCCCCDDDDEEEEFFFFCCCC``.
+
+ You can use ``address(uint160(bytes20(b)))``, which results in ``0x111122223333444455556666777788889999aAaa``,
+ or you can use ``address(uint160(uint256(b)))``, which results in ``0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc``.
+
.. note::
Starting with version 0.5.0 contracts do not derive from the address type, but can still be explicitly converted to address.