aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-09 07:37:23 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-24 08:18:18 +0800
commita36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a (patch)
tree42de13ab0c0d43e0809fc4a136fcb757b9f6fa92
parent81006dae98ee18c33994af0274de10857774ff70 (diff)
downloaddexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar.gz
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar.bz2
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar.lz
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar.xz
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.tar.zst
dexon-solidity-a36e2ce0cbb7e1830e25dacd8d79f207c9bcca6a.zip
Document transfer()
-rw-r--r--docs/control-structures.rst1
-rw-r--r--docs/miscellaneous.rst5
-rw-r--r--docs/types.rst6
-rw-r--r--docs/units-and-global-variables.rst2
4 files changed, 11 insertions, 3 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index df8ac729..ebc45965 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -395,6 +395,7 @@ Currently, Solidity automatically generates a runtime exception in the following
#. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
#. If your contract receives Ether via a public getter function.
#. If you call a zero-initialized variable of internal function type.
+#. If a ``.transfer()`` fails.
While a user-provided exception is generated in the following situations:
#. Calling ``throw``.
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 3c57507e..7b0305d5 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -465,8 +465,9 @@ Global Variables
- ``this`` (current contract's type): the current contract, explicitly convertible to ``address``
- ``super``: the contract one level higher in the inheritance hierarchy
- ``selfdestruct(address recipient)``: destroy the current contract, sending its funds to the given address
-- ``<address>.balance`` (``uint256``): balance of the address in Wei
-- ``<address>.send(uint256 amount) returns (bool)``: send given amount of Wei to address, returns ``false`` on failure
+- ``<address>.balance`` (``uint256``): balance of the :ref:`address` in Wei
+- ``<address>.send(uint256 amount) returns (bool)``: send given amount of Wei to :ref:`address`, returns ``false`` on failure
+- ``<address>.transfer(uint256 amount)``: send given amount of Wei to :ref:`address`, throws on failure
.. index:: visibility, public, private, external, internal
diff --git a/docs/types.rst b/docs/types.rst
index 69c23e6e..342b67f4 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -64,7 +64,7 @@ expression ``x << y`` is equivalent to ``x * 2**y`` and ``x >> y`` is
equivalent to ``x / 2**y``. This means that shifting negative numbers
sign extends. Shifting by a negative amount throws a runtime exception.
-.. index:: address, balance, send, call, callcode, delegatecall
+.. index:: address, balance, send, call, callcode, delegatecall, transfer
.. _address:
@@ -102,6 +102,10 @@ and to send Ether (in units of wei) to an address using the ``send`` function:
to make safe Ether transfers, always check the return value of ``send`` or even better:
Use a pattern where the recipient withdraws the money.
+* ``transfer``
+
+Transfer operates the same way as ``send``, with the exception that it will cause a exception if the transfer has failed.
+
* ``call``, ``callcode`` and ``delegatecall``
Furthermore, to interface with contracts that do not adhere to the ABI,
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 72741b67..49fe5d84 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -130,6 +130,8 @@ Address Related
balance of the :ref:`address` in Wei
``<address>.send(uint256 amount) returns (bool)``:
send given amount of Wei to :ref:`address`, returns ``false`` on failure
+``<address>.transfer(uint256 amount)``:
+ send given amount of Wei to :ref:`address`, throws on failure
For more information, see the section on :ref:`address`.