Change all instances of networkId to chainId (#2313)
* abi-gen/test: recompile contract fixtures for 3.0 It seems this hadn't been done since the merge with the 3.0 branch. * Sync `monorepo$ yarn test` exclusions to CI config * sra-spec: correct typo * contract-wrappers: TODO after coord.-server update * utils: fix typo in comment * Refactor networkId to chainId everywhere * Update CHANGELOGs
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
- Expanded documentation examples.
|
||||
- Moved methods `jsdict_to_order()` and `order_to_jsdict()` from `zero_ex.contract_wrappers.exchange.types` to `zero_ex.contract_wrappers.order_conversions`.
|
||||
- Changed field name `zero_ex.contract_wrappers.tx_params.TxParams.gasPrice` to `.gas_price`.
|
||||
- Migrated to new version of 0x-contract-addresses.
|
||||
|
||||
## 1.1.0 - 2019-08-14
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ Contract Addresses
|
||||
|
||||
The `0x-contract-addresses`:code: package (which is used by
|
||||
`0x-contract-wrappers`:code: and thus gets installed along with it) provides
|
||||
the addresses of the 0x contracts on each network, including those that come
|
||||
the addresses of the 0x contracts on each chain, including those that come
|
||||
pre-deployed deployed in the `0xorg/ganache-cli`:code: docker image. Let's
|
||||
capture the addresses we'll use throughout the examples below:
|
||||
|
||||
>>> from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
||||
>>> weth_address = network_to_addresses(NetworkId.GANACHE).ether_token
|
||||
>>> zrx_address = network_to_addresses(NetworkId.GANACHE).zrx_token
|
||||
>>> exchange_address = network_to_addresses(NetworkId.GANACHE).exchange
|
||||
>>> from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||
>>> weth_address = chain_to_addresses(ChainId.GANACHE).ether_token
|
||||
>>> zrx_address = chain_to_addresses(ChainId.GANACHE).zrx_token
|
||||
>>> exchange_address = chain_to_addresses(ChainId.GANACHE).exchange
|
||||
|
||||
Wrapping ETH
|
||||
------------
|
||||
@@ -93,14 +93,14 @@ balance:
|
||||
>>> from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
||||
>>> zrx_token = ERC20Token(
|
||||
... web3_or_provider=ganache,
|
||||
... contract_address=network_to_addresses(NetworkId.GANACHE).zrx_token,
|
||||
... contract_address=chain_to_addresses(ChainId.GANACHE).zrx_token,
|
||||
... )
|
||||
>>> weth_token = ERC20Token(
|
||||
... web3_or_provider=ganache,
|
||||
... contract_address=network_to_addresses(NetworkId.GANACHE).ether_token,
|
||||
... contract_address=chain_to_addresses(ChainId.GANACHE).ether_token,
|
||||
... )
|
||||
|
||||
>>> erc20_proxy_addr = network_to_addresses(NetworkId.GANACHE).erc20_proxy
|
||||
>>> erc20_proxy_addr = chain_to_addresses(ChainId.GANACHE).erc20_proxy
|
||||
|
||||
>>> tx = zrx_token.approve.send_transaction(
|
||||
... erc20_proxy_addr,
|
||||
@@ -165,7 +165,7 @@ Now we'll have our Taker fill the order.
|
||||
>>> from zero_ex.contract_wrappers.exchange import Exchange
|
||||
>>> exchange = Exchange(
|
||||
... web3_or_provider=ganache,
|
||||
... contract_address=network_to_addresses(NetworkId.GANACHE).exchange,
|
||||
... contract_address=chain_to_addresses(ChainId.GANACHE).exchange,
|
||||
... )
|
||||
|
||||
But before filling an order, one may wish to check that it's actually fillable:
|
||||
|
||||
@@ -5,7 +5,7 @@ from eth_utils import to_checksum_address
|
||||
from web3 import Web3
|
||||
|
||||
from zero_ex.order_utils import asset_data_utils
|
||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
||||
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||
from zero_ex.contract_artifacts import abi_by_name
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ def accounts(web3_eth): # pylint: disable=redefined-outer-name
|
||||
@pytest.fixture(scope="module")
|
||||
def erc20_proxy_address():
|
||||
"""Get the 0x ERC20 Proxy address."""
|
||||
return network_to_addresses(NetworkId.GANACHE).erc20_proxy
|
||||
return chain_to_addresses(ChainId.GANACHE).erc20_proxy
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def weth_asset_data(): # pylint: disable=redefined-outer-name
|
||||
"""Get 0x asset data for Wrapped Ether (WETH) token."""
|
||||
return asset_data_utils.encode_erc20(
|
||||
network_to_addresses(NetworkId.GANACHE).ether_token
|
||||
chain_to_addresses(ChainId.GANACHE).ether_token
|
||||
)
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ def weth_instance(web3_eth): # pylint: disable=redefined-outer-name
|
||||
"""Get an instance of the WrapperEther contract."""
|
||||
return web3_eth.contract(
|
||||
address=to_checksum_address(
|
||||
network_to_addresses(NetworkId.GANACHE).ether_token
|
||||
chain_to_addresses(ChainId.GANACHE).ether_token
|
||||
),
|
||||
abi=abi_by_name("WETH9"),
|
||||
)
|
||||
@@ -60,8 +60,8 @@ def weth_instance(web3_eth): # pylint: disable=redefined-outer-name
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def zrx_address():
|
||||
"""Get address of ZRX token for Ganache network."""
|
||||
return network_to_addresses(NetworkId.GANACHE).zrx_token
|
||||
"""Get address of ZRX token for Ganache chain."""
|
||||
return chain_to_addresses(ChainId.GANACHE).zrx_token
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
||||
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||
from zero_ex.contract_wrappers.bases import ContractMethod
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ def contract_wrapper(ganache_provider):
|
||||
"""Get a ContractMethod instance for testing."""
|
||||
return ContractMethod(
|
||||
web3_or_provider=ganache_provider,
|
||||
contract_address=network_to_addresses(NetworkId.GANACHE).ether_token,
|
||||
contract_address=chain_to_addresses(ChainId.GANACHE).ether_token,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ from decimal import Decimal
|
||||
|
||||
import pytest
|
||||
|
||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
||||
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||
from zero_ex.contract_wrappers import TxParams
|
||||
from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
||||
|
||||
@@ -16,7 +16,7 @@ MAX_ALLOWANCE = int("{:.0f}".format(Decimal(2) ** 256 - 1))
|
||||
def erc20_wrapper(ganache_provider):
|
||||
"""Get an instance of ERC20Token wrapper class for testing."""
|
||||
return ERC20Token(
|
||||
ganache_provider, network_to_addresses(NetworkId.GANACHE).ether_token
|
||||
ganache_provider, chain_to_addresses(ChainId.GANACHE).ether_token
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import random
|
||||
import pytest
|
||||
from eth_utils import remove_0x_prefix
|
||||
|
||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
||||
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||
from zero_ex.contract_wrappers import TxParams
|
||||
from zero_ex.contract_wrappers.exchange import Exchange
|
||||
from zero_ex.contract_wrappers.exchange.types import Order
|
||||
@@ -22,7 +22,7 @@ def exchange_wrapper(ganache_provider):
|
||||
"""Get an Exchange wrapper instance."""
|
||||
return Exchange(
|
||||
web3_or_provider=ganache_provider,
|
||||
contract_address=network_to_addresses(NetworkId.GANACHE).exchange,
|
||||
contract_address=chain_to_addresses(ChainId.GANACHE).exchange,
|
||||
)
|
||||
|
||||
|
||||
@@ -161,8 +161,8 @@ def test_two_instantiations_with_web3_objects(web3_instance):
|
||||
again." Test that that bug isn't occurring.
|
||||
"""
|
||||
exchange = Exchange( # pylint: disable=unused-variable
|
||||
web3_instance, network_to_addresses(NetworkId.GANACHE).exchange
|
||||
web3_instance, chain_to_addresses(ChainId.GANACHE).exchange
|
||||
)
|
||||
exchange2 = Exchange( # pylint: disable=unused-variable
|
||||
web3_instance, network_to_addresses(NetworkId.GANACHE).exchange
|
||||
web3_instance, chain_to_addresses(ChainId.GANACHE).exchange
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user