mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update syntax used for input and output parameters
This commit is contained in:
parent
b0a2e41eaf
commit
fa1cb346ae
@ -276,7 +276,7 @@ functions, annotate conditions for formal verification, and provide a
|
|||||||
function.
|
function.
|
||||||
|
|
||||||
In the following example we document the title of the contract, the explanation
|
In the following example we document the title of the contract, the explanation
|
||||||
for the two input parameters and two returned values.
|
for the two function parameters and two return variables.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ Send is the low-level counterpart of ``transfer``. If the execution fails, the c
|
|||||||
In order to interface with contracts that do not adhere to the ABI,
|
In order to interface with contracts that do not adhere to the ABI,
|
||||||
or to get more direct control over the encoding,
|
or to get more direct control over the encoding,
|
||||||
the functions ``call``, ``delegatecall`` and ``staticcall`` are provided.
|
the functions ``call``, ``delegatecall`` and ``staticcall`` are provided.
|
||||||
They all take a single ``bytes memory`` argument as input and
|
They all take a single ``bytes memory`` parameter and
|
||||||
return the success condition (as a ``bool``) and the returned data
|
return the success condition (as a ``bool``) and the returned data
|
||||||
(``bytes memory``).
|
(``bytes memory``).
|
||||||
The functions ``abi.encode``, ``abi.encodePacked``, ``abi.encodeWithSelector``
|
The functions ``abi.encode``, ``abi.encodePacked``, ``abi.encodeWithSelector``
|
||||||
|
@ -43,8 +43,8 @@ library has to be updated by an external oracle.
|
|||||||
.. note::
|
.. note::
|
||||||
The suffix ``years`` has been removed in version 0.5.0 due to the reasons above.
|
The suffix ``years`` has been removed in version 0.5.0 due to the reasons above.
|
||||||
|
|
||||||
These suffixes cannot be applied to variables. If you want to
|
These suffixes cannot be applied to variables. For example, if you want to
|
||||||
interpret some input variable in e.g. days, you can do it in the following way::
|
interpret a function parameter in days, you can in the following way::
|
||||||
|
|
||||||
function f(uint start, uint daysAfter) public {
|
function f(uint start, uint daysAfter) public {
|
||||||
if (now >= start + daysAfter * 1 days) {
|
if (now >= start + daysAfter * 1 days) {
|
||||||
@ -125,7 +125,7 @@ ABI Encoding and Decoding Functions
|
|||||||
These encoding functions can be used to craft data for external function calls without actually
|
These encoding functions can be used to craft data for external function calls without actually
|
||||||
calling an external function. Furthermore, ``keccak256(abi.encodePacked(a, b))`` is a way
|
calling an external function. Furthermore, ``keccak256(abi.encodePacked(a, b))`` is a way
|
||||||
to compute the hash of structured data (although be aware that it is possible to
|
to compute the hash of structured data (although be aware that it is possible to
|
||||||
craft a "hash collision" using different inputs types).
|
craft a "hash collision" using different function parameter types).
|
||||||
|
|
||||||
See the documentation about the :ref:`ABI <ABI>` and the
|
See the documentation about the :ref:`ABI <ABI>` and the
|
||||||
:ref:`tightly packed encoding <abi_packed_mode>` for details about the encoding.
|
:ref:`tightly packed encoding <abi_packed_mode>` for details about the encoding.
|
||||||
@ -240,4 +240,3 @@ Furthermore, all functions of the current contract are callable directly includi
|
|||||||
.. note::
|
.. note::
|
||||||
Prior to version 0.5.0, there was a function called ``suicide`` with the same
|
Prior to version 0.5.0, there was a function called ``suicide`` with the same
|
||||||
semantics as ``selfdestruct``.
|
semantics as ``selfdestruct``.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user