Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
[WIP][Docs] Add documentation for ENI types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Huang committed Sep 7, 2018
1 parent d2b0c86 commit 81c8b78
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/404.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This section does not exist yet. `(´-ι_-\`)`
8 changes: 8 additions & 0 deletions docs/documentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=============
Documentation
=============

.. toctree::
:maxdepth: 2

types
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Contents

getting-started
developer-guide
documentation
contributing
71 changes: 71 additions & 0 deletions docs/types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
=====
Types
=====

ENI Types
---------

.. _types-eni-int:

ENI Integers
````````````

All integer types in ENI is implemented using `boost::multiprecision::number <boostnumber_>`__.
Some of them are aliases for types predefined in `boost::multiprecision::cpp_int <boostcppint_>`__.

+---------------+-------------+--------+------------------------------+
| Integer Type | Size (bits) | Signed | Note |
+===============+=============+========+------------------------------+
| ``eni::s256`` | 256 || |
+---------------+-------------+--------+------------------------------+
| ``eni::Int`` | 256 || Alias for ``eni::s256``. |
+---------------+-------------+--------+------------------------------+
| ``eni::u256`` | 256 || |
+---------------+-------------+--------+------------------------------+
| ``eni::u160`` | 160 || Size of an Ethereum address. |
+---------------+-------------+--------+------------------------------+
| ``eni::u128`` | 128 || |
+---------------+-------------+--------+------------------------------+
| ``eni::u64`` | 64 || |
+---------------+-------------+--------+------------------------------+
| ``eni::UInt`` | 256 || Alias for ``eni::u256``. |
+---------------+-------------+--------+------------------------------+

Operations on ENI Integers
''''''''''''''''''''''''''

See `the documentation for boost::multiprecision::number <boostnumber_>`__ for
supported operations.

You may use `boost::lexical_cast <boostlexcast_>`__ to convert ENI integers to strings.

.. _boostnumber: https://www.boost.org/doc/libs/1_58_0/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html
.. _boostcppint: https://www.boost.org/doc/libs/1_58_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html

.. _boostlexcast: https://www.boost.org/doc/libs/1_58_0/doc/html/boost_lexical_cast.html

Suggested Use of ENI Integers
'''''''''''''''''''''''''''''

.. include:: 404.rst

.. _types-eni-bool:

ENI Boolean
```````````

``eni::Bool`` is an alias for C++ ``bool``.

.. _types-eni-addr:

ENI Address
```````````

``eni::Address`` is an alias for ``eni::u160`` (20 bytes, size of an Ethereum address).

.. _types-json:

JSON Types
----------

.. include:: 404.rst

0 comments on commit 81c8b78

Please sign in to comment.