diff options
author | chriseth <chris@ethereum.org> | 2018-09-27 19:29:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 19:29:46 +0800 |
commit | dd3459d76fb594b1df160e7a87ab0a181cd297c6 (patch) | |
tree | 923f2b9d4f4d7296ef36e6fd58ed8d413b8e35f4 /docs | |
parent | 963ae540e01dd0ab736ba0a4059d3b330b9a446d (diff) | |
parent | 927cdb3170c27f8fe7bf105a8479e286bcdc642e (diff) | |
download | dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar.gz dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar.bz2 dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar.lz dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar.xz dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.tar.zst dexon-solidity-dd3459d76fb594b1df160e7a87ab0a181cd297c6.zip |
Merge pull request #5108 from ethereum/payableWithdrawal
Explain address payable and withdraw.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/050-breaking-changes.rst | 5 | ||||
-rw-r--r-- | docs/types.rst | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index 1c12daa8..b49dd1e0 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -107,7 +107,10 @@ For most of the topics the compiler will provide suggestions. other way around is not allowed. Converting ``address`` to ``address payable`` is possible via conversion through ``uint160``. If ``c`` is a contract, ``address(c)`` results in ``address payable`` only if ``c`` has a - payable fallback function. + payable fallback function. If you use the :ref:`withdraw pattern<withdrawal_pattern>`, + you most likely do not have to change your code because ``transfer`` + is only used on ``msg.sender`` instead of stored addresses and ``msg.sender`` + is an ``address payable``. * Conversions between ``bytesX`` and ``uintY`` of different size are now disallowed due to ``bytesX`` padding on the right and ``uintY`` padding on diff --git a/docs/types.rst b/docs/types.rst index a3e782d8..84c448ff 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -189,6 +189,13 @@ has the type ``address payable``, if ``x`` is of integer or fixed bytes type, a If ``x`` is a contract without payable fallback function, then ``address(x)`` will be of type ``address``. In external function signatures ``address`` is used for both the ``address`` and the ``address payable`` type. +.. note:: + It might very well be that you do not need to care about the distinction between ``address`` + and ``address payable`` and just use ``address`` everywhere. For example, + if you are using the :ref:`withdrawal pattern<withdrawal_pattern>`, you can (and should) store the + address itself as ``address``, because you invoke the ``transfer`` function on + ``msg.sender``, which is an ``address payable``. + Operators: * ``<=``, ``<``, ``==``, ``!=``, ``>=`` and ``>`` |