-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #2095 - Provide constants for e.g. the zero address and max uin…
…t256 (#2109)
- Loading branch information
1 parent
13685d6
commit 73d7da0
Showing
11 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.. _constants: | ||
|
||
Constants | ||
========= | ||
|
||
The web3.contants module contains commonly used values. | ||
|
||
Strings | ||
******* | ||
|
||
.. code-block:: python | ||
#The Address Zero, which is 20 bytes (40 nibbles) of zero. | ||
web3.constants.ADDRESS_ZERO | ||
#The hexadecimal version of Max uint256. | ||
web3.constants.MAX_INT | ||
#The Hash Zero, which is 32 bytes (64 nibbles) of zero. | ||
web3.constants.HASH_ZERO | ||
Int | ||
*** | ||
|
||
.. code-block:: python | ||
#The amount of Wei in one Ether | ||
web3.constants.WEI_PER_ETHER | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ Table of Contents | |
web3.parity | ||
gas_price | ||
ens | ||
constants | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add constants for the zero address, zero hash, max int, and wei per ether. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Constants as Strings | ||
ADDRESS_ZERO = "0x0000000000000000000000000000000000000000" | ||
|
||
MAX_INT = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" | ||
|
||
HASH_ZERO = "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
|
||
# Constants as Int | ||
WEI_PER_ETHER = 1000000000000000000 |