Skip to content

Commit d59706e

Browse files
docs: fix formatting errors and style inconsistencies
1 parent c59854c commit d59706e

11 files changed

+68
-56
lines changed

docs/contracts/functions.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ In addition to the list of state modifying statements explained above, the follo
195195
}
196196
}
197197

198-
Pure functions are able to use the `revert()` and `require()` functions to revert
198+
Pure functions are able to use the ``revert()`` and ``require()`` functions to revert
199199
potential state changes when an :ref:`error occurs <assert-and-require>`.
200200

201201
Reverting a state change is not considered a "state modification", as only changes to the
@@ -235,17 +235,17 @@ A contract can have at most one ``receive`` function, declared using
235235
``receive() external payable { ... }``
236236
(without the ``function`` keyword).
237237
This function cannot have arguments, cannot return anything and must have
238-
``external`` visibility and ``payable`` state mutability. It is executed on a
238+
``external`` visibility and ``payable`` state mutability. It is executed on a
239239
call to the contract with empty calldata. This is the function that is executed
240-
on plain Ether transfers (e.g. via `.send()` or `.transfer()`). If no such
240+
on plain Ether transfers (e.g. via ``.send()`` or ``.transfer()``). If no such
241241
function exists, but a payable :ref:`fallback function <fallback-function>`
242242
exists, the fallback function will be called on a plain Ether transfer. If
243243
neither a receive Ether nor a payable fallback function is present, the
244244
contract cannot receive Ether through regular transactions and throws an
245245
exception.
246246

247247
In the worst case, the fallback function can only rely on 2300 gas being
248-
available (for example when `send` or `transfer` is used), leaving little
248+
available (for example when ``send`` or ``transfer`` is used), leaving little
249249
room to perform other operations except basic logging. The following operations
250250
will consume more gas than the 2300 gas stipend:
251251

@@ -265,7 +265,7 @@ will consume more gas than the 2300 gas stipend:
265265

266266
.. warning::
267267
A contract without a receive Ether function can receive Ether as a
268-
recipient of a `coinbase transaction` (aka `miner block reward`)
268+
recipient of a *coinbase transaction* (aka *miner block reward*)
269269
or as a destination of a ``selfdestruct``.
270270

271271
A contract cannot react to such Ether transfers and thus also

docs/contracts/visibility-and-getters.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Functions have to be specified as being ``external``,
1616
``public``, ``internal`` or ``private``.
1717
For state variables, ``external`` is not possible.
1818

19-
``external``:
19+
``external``
2020
External functions are part of the contract interface,
2121
which means they can be called from other contracts and
2222
via transactions. An external function ``f`` cannot be called
@@ -25,18 +25,18 @@ For state variables, ``external`` is not possible.
2525
they receive large arrays of data, because the data
2626
is not copied from calldata to memory.
2727

28-
``public``:
28+
``public``
2929
Public functions are part of the contract interface
3030
and can be either called internally or via
3131
messages. For public state variables, an automatic getter
3232
function (see below) is generated.
3333

34-
``internal``:
34+
``internal``
3535
Those functions and state variables can only be
3636
accessed internally (i.e. from within the current contract
3737
or contracts deriving from it), without using ``this``.
3838

39-
``private``:
39+
``private``
4040
Private functions and state variables are only
4141
visible for the contract they are defined in and not in
4242
derived contracts.

docs/examples/micropayment.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ The recipient should verify each message using the following process:
454454

455455
We'll use the `ethereumjs-util <https://github.com/ethereumjs/ethereumjs-util>`_
456456
library to write this verification. The final step can be done a number of ways,
457-
and we use JavaScript. The following code borrows the `constructMessage` function from the signing **JavaScript code** above:
457+
and we use JavaScript. The following code borrows the ``constructMessage`` function from the signing **JavaScript code** above:
458458

459459
::
460460

docs/installing-solidity.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ or if you require more compilation options.
3535
npm / Node.js
3636
=============
3737

38-
Use `npm` for a convenient and portable way to install `solcjs`, a Solidity compiler. The
38+
Use ``npm`` for a convenient and portable way to install ``solcjs``, a Solidity compiler. The
3939
`solcjs` program has fewer features than the ways to access the compiler described
4040
further down this page. The
4141
:ref:`commandline-compiler` documentation assumes you are using
42-
the full-featured compiler, `solc`. The usage of `solcjs` is documented inside its own
42+
the full-featured compiler, ``solc``. The usage of ``solcjs`` is documented inside its own
4343
`repository <https://github.com/ethereum/solc-js>`_.
4444

4545
Note: The solc-js project is derived from the C++
@@ -53,10 +53,10 @@ Please refer to the solc-js repository for instructions.
5353
5454
.. note::
5555

56-
The commandline executable is named `solcjs`.
56+
The commandline executable is named ``solcjs``.
5757

58-
The comandline options of `solcjs` are not compatible with `solc` and tools (such as `geth`)
59-
expecting the behaviour of `solc` will not work with `solcjs`.
58+
The comandline options of ``solcjs`` are not compatible with ``solc`` and tools (such as ``geth``)
59+
expecting the behaviour of ``solc`` will not work with ``solcjs``.
6060

6161
Docker
6262
======

docs/introduction-to-smart-contracts.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Every account has a persistent key-value store mapping 256-bit words to 256-bit
323323
words called **storage**.
324324

325325
Furthermore, every account has a **balance** in
326-
Ether (in "Wei" to be exact, `1 ether` is `10**18 wei`) which can be modified by sending transactions that
326+
Ether (in "Wei" to be exact, ``1 ether`` is ``10**18 wei``) which can be modified by sending transactions that
327327
include Ether.
328328

329329
.. index:: ! transaction
@@ -520,9 +520,9 @@ idea, but it is potentially dangerous, as if someone sends Ether to removed
520520
contracts, the Ether is forever lost.
521521

522522
.. warning::
523-
Even if a contract is removed by "selfdestruct", it is still part of the
523+
Even if a contract is removed by ``selfdestruct``, it is still part of the
524524
history of the blockchain and probably retained by most Ethereum nodes.
525-
So using "selfdestruct" is not the same as deleting data from a hard disk.
525+
So using ``selfdestruct`` is not the same as deleting data from a hard disk.
526526

527527
.. note::
528528
Even if a contract's code does not contain a call to ``selfdestruct``,

docs/natspec-format.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Tags
7373

7474
All tags are optional. The following table explains the purpose of each
7575
NatSpec tag and where it may be used. As a special case, if no tags are
76-
used then the Solidity compiler will interpret a `///` or `/**` comment
77-
in the same way as if it were tagged with `@notice`.
76+
used then the Solidity compiler will interpret a ``///`` or ``/**`` comment
77+
in the same way as if it were tagged with ``@notice``.
7878

7979
=========== =============================================================================== =============================
8080
Tag Context

docs/style-guide.rst

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ solidity code. The goal of this guide is *consistency*. A quote from python's
2424
`pep8 <https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds>`_
2525
captures this concept well.
2626

27+
.. note::
28+
2729
A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important.
28-
But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgement. Look at other examples and decide what looks best. And don't hesitate to ask!
30+
31+
But most importantly: **know when to be inconsistent** -- sometimes the style guide just doesn't apply. When in doubt, use your best judgement. Look at other examples and decide what looks best. And don't hesitate to ask!
2932

3033

3134
***********
@@ -383,8 +386,7 @@ No::
383386

384387
function spam(uint i , Coin coin) public ;
385388

386-
More than one space around an assignment or other operator to align with
387-
another:
389+
More than one space around an assignment or other operator to align with another:
388390

389391
Yes::
390392

@@ -996,7 +998,7 @@ Contract and Library Names
996998
* Contract and library names should also match their filenames.
997999
* If a contract file includes multiple contracts and/or libraries, then the filename should match the *core contract*. This is not recommended however if it can be avoided.
9981000

999-
As shown in the example below, if the contract name is `Congress` and the library name is `Owned`, then their associated filenames should be `Congress.sol` and `Owned.sol`.
1001+
As shown in the example below, if the contract name is ``Congress`` and the library name is ``Owned``, then their associated filenames should be ``Congress.sol`` and ``Owned.sol``.
10001002

10011003
Yes::
10021004

@@ -1132,8 +1134,8 @@ Solidity contracts can have a form of comments that are the basis of the
11321134
Ethereum Natural Language Specification Format.
11331135

11341136
Add comments above functions or contracts following `doxygen <http://www.doxygen.nl>`_ notation
1135-
of one or multiple lines starting with `///` or a
1136-
multiline comment starting with `/**` and ending with `*/`.
1137+
of one or multiple lines starting with ``///`` or a
1138+
multiline comment starting with ``/**`` and ending with ``*/``.
11371139

11381140
For example, the contract from `a simple smart contract <simple-smart-contract>`_ with the comments
11391141
added looks like the one below::

docs/types.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ operators. For a quick reference of the various operators, see :ref:`order`.
1616
The concept of "undefined" or "null" values does not exist in Solidity, but newly
1717
declared variables always have a :ref:`default value<default-value>` dependent
1818
on its type. To handle any unexpected values, you should use the :ref:`revert function<assert-and-require>` to revert the whole transaction, or return a
19-
tuple with a second `bool` value denoting success.
19+
tuple with a second ``bool`` value denoting success.
2020

2121
.. include:: types/value-types.rst
2222

@@ -26,4 +26,4 @@ tuple with a second `bool` value denoting success.
2626

2727
.. include:: types/operators.rst
2828

29-
.. include:: types/conversion.rst
29+
.. include:: types/conversion.rst

docs/types/value-types.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ the :ref:`address type<address>`.
332332
Before version 0.5.0, contracts directly derived from the address type
333333
and there was no distinction between ``address`` and ``address payable``.
334334

335-
If you declare a local variable of contract type (`MyContract c`), you can call
335+
If you declare a local variable of contract type (``MyContract c``), you can call
336336
functions on that contract. Take care to assign it from somewhere that is the
337337
same contract type.
338338

docs/units-and-global-variables.rst

+34-25
Original file line numberDiff line numberDiff line change
@@ -140,48 +140,52 @@ Error Handling
140140
See the dedicated section on :ref:`assert and require<assert-and-require>` for
141141
more details on error handling and when to use which function.
142142

143-
``assert(bool condition)``:
143+
``assert(bool condition)``
144144
causes an invalid opcode and thus state change reversion if the condition is not met - to be used for internal errors.
145-
``require(bool condition)``:
145+
146+
``require(bool condition)``
146147
reverts if the condition is not met - to be used for errors in inputs or external components.
147-
``require(bool condition, string memory message)``:
148+
149+
``require(bool condition, string memory message)``
148150
reverts if the condition is not met - to be used for errors in inputs or external components. Also provides an error message.
149-
``revert()``:
151+
152+
``revert()``
150153
abort execution and revert state changes
151-
``revert(string memory reason)``:
154+
155+
``revert(string memory reason)``
152156
abort execution and revert state changes, providing an explanatory string
153157

154158
.. index:: keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography,
155159

156160
Mathematical and Cryptographic Functions
157161
----------------------------------------
158162

159-
``addmod(uint x, uint y, uint k) returns (uint)``:
163+
``addmod(uint x, uint y, uint k) returns (uint)``
160164
compute ``(x + y) % k`` where the addition is performed with arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0.
161165

162-
``mulmod(uint x, uint y, uint k) returns (uint)``:
166+
``mulmod(uint x, uint y, uint k) returns (uint)``
163167
compute ``(x * y) % k`` where the multiplication is performed with arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0.
164168

165-
``keccak256(bytes memory) returns (bytes32)``:
169+
``keccak256(bytes memory) returns (bytes32)``
166170
compute the Keccak-256 hash of the input
167171

168172
.. note::
169173

170174
There used to be an alias for ``keccak256`` called ``sha3``, which was removed in version 0.5.0.
171175

172-
``sha256(bytes memory) returns (bytes32)``:
176+
``sha256(bytes memory) returns (bytes32)``
173177
compute the SHA-256 hash of the input
174178

175-
``ripemd160(bytes memory) returns (bytes20)``:
179+
``ripemd160(bytes memory) returns (bytes20)``
176180
compute RIPEMD-160 hash of the input
177181

178-
``ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address)``:
182+
``ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address)``
179183
recover the address associated with the public key from elliptic curve signature or return zero on error.
180184
The function parameters correspond to ECDSA values of the signature:
181185

182-
``r`` = first 32 bytes of signature
183-
``s`` = second 32 bytes of signature
184-
``v`` = final 1 byte of signature
186+
* ``r`` = first 32 bytes of signature
187+
* ``s`` = second 32 bytes of signature
188+
* ``v`` = final 1 byte of signature
185189

186190
``ecrecover`` returns an ``address``, and not an ``address payable``. See :ref:`address payable<address>` for
187191
conversion, in case you need to transfer funds to the recovered address.
@@ -209,17 +213,22 @@ Mathematical and Cryptographic Functions
209213
Members of Address Types
210214
------------------------
211215

212-
``<address>.balance`` (``uint256``):
216+
``<address>.balance`` (``uint256``)
213217
balance of the :ref:`address` in Wei
214-
``<address payable>.transfer(uint256 amount)``:
218+
219+
``<address payable>.transfer(uint256 amount)``
215220
send given amount of Wei to :ref:`address`, reverts on failure, forwards 2300 gas stipend, not adjustable
216-
``<address payable>.send(uint256 amount) returns (bool)``:
221+
222+
``<address payable>.send(uint256 amount) returns (bool)``
217223
send given amount of Wei to :ref:`address`, returns ``false`` on failure, forwards 2300 gas stipend, not adjustable
218-
``<address>.call(bytes memory) returns (bool, bytes memory)``:
224+
225+
``<address>.call(bytes memory) returns (bool, bytes memory)``
219226
issue low-level ``CALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
220-
``<address>.delegatecall(bytes memory) returns (bool, bytes memory)``:
227+
228+
``<address>.delegatecall(bytes memory) returns (bool, bytes memory)``
221229
issue low-level ``DELEGATECALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
222-
``<address>.staticcall(bytes memory) returns (bool, bytes memory)``:
230+
231+
``<address>.staticcall(bytes memory) returns (bool, bytes memory)``
223232
issue low-level ``STATICCALL`` with the given payload, returns success condition and return data, forwards all available gas, adjustable
224233

225234
For more information, see the section on :ref:`address`.
@@ -258,10 +267,10 @@ For more information, see the section on :ref:`address`.
258267
Contract Related
259268
----------------
260269

261-
``this`` (current contract's type):
270+
``this`` (current contract's type)
262271
the current contract, explicitly convertible to :ref:`address`
263272

264-
``selfdestruct(address payable recipient)``:
273+
``selfdestruct(address payable recipient)``
265274
Destroy the current contract, sending its funds to the given :ref:`address`
266275
and end execution.
267276
Note that ``selfdestruct`` has some peculiarities inherited from the EVM:
@@ -290,18 +299,18 @@ type ``X``. Currently, there is limited support for this feature, but
290299
it might be expanded in the future. The following properties are
291300
available for a contract type ``C``:
292301

293-
``type(C).name``:
302+
``type(C).name``
294303
The name of the contract.
295304

296-
``type(C).creationCode``:
305+
``type(C).creationCode``
297306
Memory byte array that contains the creation bytecode of the contract.
298307
This can be used in inline assembly to build custom creation routines,
299308
especially by using the ``create2`` opcode.
300309
This property can **not** be accessed in the contract itself or any
301310
derived contract. It causes the bytecode to be included in the bytecode
302311
of the call site and thus circular references like that are not possible.
303312

304-
``type(C).runtimeCode``:
313+
``type(C).runtimeCode``
305314
Memory byte array that contains the runtime bytecode of the contract.
306315
This is the code that is usually deployed by the constructor of ``C``.
307316
If ``C`` has a constructor that uses inline assembly, this might be

docs/using-the-compiler.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ Target options
106106
Below is a list of target EVM versions and the compiler-relevant changes introduced
107107
at each version. Backward compatibility is not guaranteed between each version.
108108

109-
- ``homestead`` (oldest version)
109+
- ``homestead``
110+
- (oldest version)
110111
- ``tangerineWhistle``
111112
- Gas cost for access to other accounts increased, relevant for gas estimation and the optimizer.
112113
- All gas sent by default for external calls, previously a certain amount had to be retained.
@@ -692,7 +693,7 @@ Review changes
692693

693694
The command above applies all changes as shown below. Please review them carefully.
694695

695-
.. code-block:: none
696+
.. code-block:: solidity
696697
697698
pragma solidity >=0.6.0 <0.7.0;
698699

0 commit comments

Comments
 (0)