Metadata-Version: 2.1
Name: ethtoken
Version: 0.0.1a4
Summary: Ethereum EIP20 Token Interface
Home-page: https://github.com/carver/ethtoken.py
Author: Jason Carver
Author-email: ut96caarrs@snkmail.com
License: MIT
Keywords: ethereum erc20 token eip20 ICO ETH
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: web3 (<5.0.0,>=4.0.0)
Provides-Extra: dev
Requires-Dist: bumpversion (<1,>=0.5.3); extra == 'dev'
Requires-Dist: pytest-xdist; extra == 'dev'
Requires-Dist: pytest-watch (<5,>=4.1.0); extra == 'dev'
Requires-Dist: wheel; extra == 'dev'
Requires-Dist: ipython; extra == 'dev'
Requires-Dist: pytest (==3.3.2); extra == 'dev'
Requires-Dist: tox (<3,>=2.9.1); extra == 'dev'
Requires-Dist: flake8 (==3.4.1); extra == 'dev'
Requires-Dist: isort (<5,>=4.2.15); extra == 'dev'
Requires-Dist: Sphinx (<2,>=1.6.5); extra == 'dev'
Requires-Dist: sphinx-rtd-theme (>=0.1.9); extra == 'dev'
Provides-Extra: doc
Requires-Dist: Sphinx (<2,>=1.6.5); extra == 'doc'
Requires-Dist: sphinx-rtd-theme (>=0.1.9); extra == 'doc'
Provides-Extra: lint
Requires-Dist: flake8 (==3.4.1); extra == 'lint'
Requires-Dist: isort (<5,>=4.2.15); extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest (==3.3.2); extra == 'test'
Requires-Dist: tox (<3,>=2.9.1); extra == 'test'

ethtoken.py
===========

This is a tiny library leveraging web3.py to make an interface for
working with
`EIP20 <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md>`__
tokens on Ethereum. (formerly ERC20)

**It is currently in Alpha, with 0 automated tests**

Usage
-----

Install
~~~~~~~

.. code:: sh

    virtualenv -p python3 venv
    . venv/bin/activate
    pip install --pre ethtoken

Initialize
~~~~~~~~~~

.. code:: py

    from ethtoken import token

    # Use the ENS name that points to your token contract here:
    omg = token("omg.thetoken.eth")

Use standard EIP20 methods
~~~~~~~~~~~~~~~~~~~~~~~~~~

Most EIP20 methods are optional. ``ethtoken`` makes no attempt to verify
which methods are implemented by a token contract.

Here's an example with all the read functions working:

.. code:: py

    >>> omg.name()
    'OMGToken'

    >>> omg.symbol()
    'OMG'

    >>> omg.decimals()
    18

    >>> omg.totalSupply()
    140245398245132780789239631

    # Use the ENS name of the owner address here:
    >>> omg.balanceOf('ethereumfoundation.eth')
    308744633639977714804

Custom methods
~~~~~~~~~~~~~~

``ethtoken`` has a single custom method not in the EIP20 spec:
``token_balance``.

.. code:: py

    >>> omg.token_balance("ethereumfoundation.eth")
    Decimal('308.744633639977714804')

It returns the balance of an address, with the decimal point shifted
according to the ``decimals()`` value on the contract. In other words,
it is the human-readable number of tokens that the given address owns.

Completely Untested: Transfers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In theory, you could use this to send a token. I haven't even tried it
once yet. Just don't use it. If you're going to ignore me, don't blame
me if you lose tokens or ether.

This should theoretically transfer 1 giga units from 0x0 to 0xdead.
(That's 1 nanotoken, at 18 decimals). Of course, this won't work if you
don't control the 0x0 address. (hint: you don't)

.. code:: py

    from web3 import Web3

    >>> omg.transfer(
      '0x000000000000000000000000000000000000dEaD',
      10 ** 9,
      transact={
        'from': '0x0000000000000000000000000000000000000000',
        'gasPrice': Web3.toWei('0.1', 'gwei'),
      },
    )

Ownership Disclosure
~~~~~~~~~~~~~~~~~~~~

I own some OmiseGo tokens, because anyone who had some ether during
their airdrop got some. I don't have any opinions on the company or
token.


