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/doctest: rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
feuGeneA committed Jul 12, 2019
1 parent 3ac6e3b commit ca52224
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@
balance:
>>> from zero_ex.contract_wrappers import ERC20Token
>>> zrx_wrapper = ERC20Token(
>>> zrx_token = ERC20Token(
... provider=ganache,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].zrx_token,
... )
>>> weth_wrapper = ERC20Token(
>>> weth_token = ERC20Token(
... provider=ganache,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].ether_token,
... )
>>> erc20_proxy_addr = NETWORK_TO_ADDRESSES[NetworkId.GANACHE].erc20_proxy
>>> tx = zrx_wrapper.approve(
>>> tx = zrx_token.approve(
... erc20_proxy_addr,
... to_wei(100, 'ether'),
... tx_params=TxParams(from_=maker_address),
... )
>>> tx = weth_wrapper.approve(
>>> tx = weth_token.approve(
... erc20_proxy_addr,
... to_wei(100, 'ether'),
... tx_params=TxParams(from_=taker_address),
Expand Down Expand Up @@ -162,11 +162,11 @@
too.
>>> from zero_ex.contract_wrappers import Exchange
>>> exchange_contract = Exchange(
>>> exchange = Exchange(
... provider=ganache,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].exchange,
... )
>>> tx_hash = exchange_contract.fill_order(
>>> tx_hash = exchange.fill_order(
... order=order,
... taker_asset_fill_amount=order["takerAssetAmount"],
... signature=maker_signature,
Expand All @@ -176,10 +176,10 @@
Once the transaction is mined, we can get the details of our exchange through
the exchange wrapper:
>>> exchange_contract.get_fill_event(tx_hash)
>>> exchange.get_fill_event(tx_hash)
(AttributeDict({'args': ...({'makerAddress': ...}), 'event': 'Fill', ...}),)
>>> from pprint import pprint
>>> pprint(exchange_contract.get_fill_event(tx_hash)[0].args.__dict__)
>>> pprint(exchange.get_fill_event(tx_hash)[0].args.__dict__)
{'feeRecipientAddress': '0x0000000000000000000000000000000000000000',
'makerAddress': '0x...',
'makerAssetData': b...,
Expand All @@ -191,7 +191,7 @@
'takerAssetData': b...,
'takerAssetFilledAmount': 100000000000000000,
'takerFeePaid': 0}
>>> exchange_contract.get_fill_event(tx_hash)[0].args.takerAssetFilledAmount
>>> exchange.get_fill_event(tx_hash)[0].args.takerAssetFilledAmount
100000000000000000
Cancelling an order
Expand All @@ -217,23 +217,23 @@
... )
... )
>>> tx_hash = exchange_contract.cancel_order(
>>> tx_hash = exchange.cancel_order(
... order=order, tx_params=TxParams(from_=maker_address)
... )
Once the transaction is mined, we can get the details of the cancellation
through the Exchange wrapper:
>>> exchange_contract.get_cancel_event(tx_hash)
>>> exchange.get_cancel_event(tx_hash)
(AttributeDict({'args': ...({'makerAddress': ...}), 'event': 'Cancel', ...}),)
>>> pprint(exchange_contract.get_cancel_event(tx_hash)[0].args.__dict__)
>>> pprint(exchange.get_cancel_event(tx_hash)[0].args.__dict__)
{'feeRecipientAddress': '0x0000000000000000000000000000000000000000',
'makerAddress': '0x...',
'makerAssetData': b...,
'orderHash': b...,
'senderAddress': '0x...',
'takerAssetData': b...}
>>> exchange_contract.get_cancel_event(tx_hash)[0].args.feeRecipientAddress
>>> exchange.get_cancel_event(tx_hash)[0].args.feeRecipientAddress
'0x0000000000000000000000000000000000000000'
Batching orders
Expand Down Expand Up @@ -287,7 +287,7 @@
Fill order_1 and order_2 together:
>>> exchange_contract.batch_fill_orders(
>>> exchange.batch_fill_orders(
... orders=[order_1, order_2],
... taker_asset_fill_amounts=[1, 2],
... signatures=[signature_1, signature_2],
Expand Down

0 comments on commit ca52224

Please sign in to comment.