Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
contract_wrappers.py: don't auto-import wrappers
Browse files Browse the repository at this point in the history
This was discovered while minimizing CircleCI steps to dianose a problem
with running the Launch Kit Backend in CircleCI.

These classes should be imported via the
zero_ex.contract_wrappers.exchange and
zero_ex.contract_wrappers.erc20_token modules, respectively.  We
permitted importing them from just zero_ex.contract_wrappers back when
they were the only wrappers we had, but now that we have so many
different contracts being wrapped, this is just another list to keep
manually updated (which, obviously is error prone, since it slipped
through the cracks already), so it's better to just not support this
type of import.
  • Loading branch information
feuGeneA committed Aug 8, 2019
1 parent 05537e0 commit a598a8f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions python-packages/contract_wrappers/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Python zero_ex.contract_wrappers
:members:


zero_ex.contract_wrappers.Exchange
zero_ex.contract_wrappers.exchange
==================================

.. autoclass:: zero_ex.contract_wrappers.Exchange
.. automodule:: zero_ex.contract_wrappers.exchange
:members:
:special-members:


zero_ex.contract_wrappers.ERC20Token
====================================
zero_ex.contract_wrappers.erc20_token
=====================================

.. autoclass:: zero_ex.contract_wrappers.ERC20Token
.. automodule:: zero_ex.contract_wrappers.erc20_token
:members:
:special-members:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
we need to tell the WETH token contract to let the 0x contracts transfer our
balance:
>>> from zero_ex.contract_wrappers import ERC20Token
>>> from zero_ex.contract_wrappers.erc20_token import ERC20Token
>>> zrx_token = ERC20Token(
... provider=ganache,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].zrx_token,
Expand Down Expand Up @@ -161,7 +161,7 @@
fill. This example fills the order completely, but partial fills are possible
too.
>>> from zero_ex.contract_wrappers import Exchange
>>> from zero_ex.contract_wrappers.exchange import Exchange
>>> exchange = Exchange(
... provider=ganache,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].exchange,
Expand Down Expand Up @@ -324,5 +324,3 @@
"""

from .tx_params import TxParams
from .erc20_token import ERC20Token
from .exchange import Exchange
3 changes: 2 additions & 1 deletion python-packages/contract_wrappers/test/test_erc20_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import pytest

from zero_ex.contract_addresses import NETWORK_TO_ADDRESSES, NetworkId
from zero_ex.contract_wrappers import ERC20Token, TxParams
from zero_ex.contract_wrappers import TxParams
from zero_ex.contract_wrappers.erc20_token import ERC20Token


MAX_ALLOWANCE = int("{:.0f}".format(Decimal(2) ** 256 - 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from eth_utils import remove_0x_prefix

from zero_ex.contract_addresses import NETWORK_TO_ADDRESSES, NetworkId
from zero_ex.contract_wrappers import Exchange, TxParams
from zero_ex.contract_wrappers import TxParams
from zero_ex.contract_wrappers.exchange import Exchange
from zero_ex.contract_wrappers.exchange.types import Order
from zero_ex.json_schemas import assert_valid
from zero_ex.order_utils import generate_order_hash_hex, sign_hash_to_bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@
Recall that in a previous example we selected a specific order from the order
book. Now let's have the taker fill it:
>>> from zero_ex.contract_wrappers import Exchange, TxParams
>>> from zero_ex.contract_wrappers import TxParams
>>> from zero_ex.contract_wrappers.exchange import Exchange
>>> from zero_ex.order_utils import Order
>>> exchange = Exchange(
... provider=eth_node,
Expand Down

0 comments on commit a598a8f

Please sign in to comment.