aboutsummaryrefslogtreecommitdiffstats
path: root/docs/types.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/types.rst')
-rw-r--r--docs/types.rst18
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 69c23e6e..f7d1d54f 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:
@@ -80,27 +80,31 @@ Operators:
Members of Addresses
^^^^^^^^^^^^^^^^^^^^
-* ``balance`` and ``send``
+* ``balance`` and ``transfer``
For a quick reference, see :ref:`address_related`.
It is possible to query the balance of an address using the property ``balance``
-and to send Ether (in units of wei) to an address using the ``send`` function:
+and to send Ether (in units of wei) to an address using the ``transfer`` function:
::
address x = 0x123;
address myAddress = this;
- if (x.balance < 10 && myAddress.balance >= 10) x.send(10);
+ if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10);
.. note::
- If ``x`` is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the ``send`` call (this is a limitation of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted. In this case, ``send`` returns ``false``.
+ If ``x`` is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the ``transfer`` call (this is a limitation of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted and the current contract will stop with an exception.
+
+* ``send``
+
+Send is the low-level counterpart of ``transfer``. If the execution fails, the current contract will not stop with an exception, but ``send`` will return ``false``.
.. warning::
There are some dangers in using ``send``: The transfer fails if the call stack depth is at 1024
(this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order
- to make safe Ether transfers, always check the return value of ``send`` or even better:
- Use a pattern where the recipient withdraws the money.
+ to make safe Ether transfers, always check the return value of ``send``, use ``transfer`` or even better:
+ use a pattern where the recipient withdraws the money.
* ``call``, ``callcode`` and ``delegatecall``