You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/abi-spec.rst
+18-12Lines changed: 18 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,21 +40,21 @@ The following elementary types exist:
40
40
41
41
- ``int<M>``: two's complement signed integer type of ``M`` bits, ``0 < M <= 256``, ``M % 8 == 0``.
42
42
43
-
- ``address``: equivalent to ``uint160``, except for the assumed interpretation and language typing.
43
+
- ``address``: equivalent to ``uint160``, except for the assumed interpretation and language typing. For computing the function selector, ``address`` is used.
44
44
45
-
- ``uint``, ``int``: synonyms for ``uint256``, ``int256`` respectively (this shorthand not to be used for computing the function selector).
45
+
- ``uint``, ``int``: synonyms for ``uint256``, ``int256`` respectively. For computing the function selector, ``uint256`` and ``int256`` have to be used.
46
46
47
-
- ``bool``: equivalent to ``uint8`` restricted to the values 0 and 1
47
+
- ``bool``: equivalent to ``uint8`` restricted to the values 0 and 1. For computing the function selector, ``bool`` is used.
48
48
49
49
- ``fixed<M>x<N>``: signed fixed-point decimal number of ``M`` bits, ``8 <= M <= 256``, ``M % 8 ==0``, and ``0 < N <= 80``, which denotes the value ``v`` as ``v / (10 ** N)``.
50
50
51
51
- ``ufixed<M>x<N>``: unsigned variant of ``fixed<M>x<N>``.
52
52
53
-
- ``fixed``, ``ufixed``: synonyms for ``fixed128x19``, ``ufixed128x19`` respectively (this shorthand not to be used for computing the function selector).
53
+
- ``fixed``, ``ufixed``: synonyms for ``fixed128x19``, ``ufixed128x19`` respectively. For computing the function selector, ``fixed128x19`` and ``ufixed128x19`` have to be used.
54
54
55
55
- ``bytes<M>``: binary type of ``M`` bytes, ``0 < M <= 32``.
56
56
57
-
- ``function``: equivalent to ``bytes24``: an address, followed by a function selector
57
+
- ``function``: an address (20 bytes) folled by a function selector (4 bytes). Encoded identical to ``bytes24``.
58
58
59
59
The following (fixed-size) array type exists:
60
60
@@ -187,12 +187,12 @@ Given the contract:
187
187
188
188
::
189
189
190
-
pragma solidity ^0.4.0;
190
+
pragma solidity ^0.4.16;
191
191
192
192
contract Foo {
193
-
function bar(bytes3[2] xy) {}
194
-
function baz(uint32 x, bool y) returns (bool r) { r = x > 32 || y; }
195
-
function sam(bytes name, bool z, uint[] data) {}
193
+
function bar(bytes3[2]) public pure {}
194
+
function baz(uint32 x, bool y) public pure returns (bool r) { r = x > 32 || y; }
195
+
function sam(bytes, bool, uint[]) public pure {}
196
196
}
197
197
198
198
@@ -288,6 +288,8 @@ In effect, a log entry using this ABI is described as:
288
288
- ``topics[n]``: ``EVENT_INDEXED_ARGS[n - 1]`` (``EVENT_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are indexed);
289
289
- ``data``: ``abi_serialise(EVENT_NON_INDEXED_ARGS)`` (``EVENT_NON_INDEXED_ARGS`` is the series of ``EVENT_ARGS`` that are not indexed, ``abi_serialise`` is the ABI serialisation function used for returning a series of typed values from a function, as described above).
290
290
291
+
For all fixed-length Solidity types, the ``EVENT_INDEXED_ARGS`` array contains the 32-byte encoded value directly. However, for *types of dynamic length*, which include ``string``, ``bytes``, and arrays, ``EVENT_INDEXED_ARGS`` will contain the *Keccak hash* of the encoded value, rather than the encoded value directly. This allows applications to efficiently query for values of dynamic-length types (by setting the hash of the encoded value as the topic), but leaves applications unable to decode indexed values they have not queried for. For dynamic-length types, application developers face a trade-off between fast search for predetermined values (if the argument is indexed) and legibility of arbitrary values (which requires that the arguments not be indexed). Developers may overcome this tradeoff and achieve both efficient search and arbitrary legibility by defining events with two arguments — one indexed, one not — intended to hold the same value.
292
+
291
293
JSON
292
294
====
293
295
@@ -333,10 +335,10 @@ For example,
333
335
pragma solidity ^0.4.0;
334
336
335
337
contract Test {
336
-
function Test(){ b = 0x12345678901234567890123456789012; }
338
+
function Test() public { b = 0x12345678901234567890123456789012; }
0 commit comments