Python zero_ex.contract_wrappers

Python wrappers for interacting with 0x smart contracts.

The smart contract wrappers have simplified interfaces, performing client-side validation on transactions, and throwing helpful error messages.

Setup

Install the 0x-contract-wrappers with pip:

pip install 0x-contract-wrappers

We need a Web3 provider to allow us to talk to the blockchain. You can read more about providers in the Web3.py documentation. The examples below assume there’s a local instance of Ganache listening on port 8545:

>>> from web3 import HTTPProvider
>>> ganache = HTTPProvider("http://localhost:8545")

To replicate these examples, one can use the 0xorg/ganache-cli docker image, which comes with the 0x contracts pre-deployed. To start it:

docker run -d -p 8545:8545 0xorg/ganache-cli

Accounts

In the examples below, we will use the accounts provided by Ganache, which are accessible through the Web3 instance. The first account will be the maker, and the second account will be the taker.

>>> from web3 import Web3
>>> accounts = Web3(ganache).eth.accounts
>>> maker_address = accounts[0]
>>> taker_address = accounts[1]

In the examples below, we’ll use the optional tx_params parameter to the contract calls, in order to specify which account each transaction is to originate from. Under normal circumstances, your provider will have a default account which will be used if you decline to specify an originating address. For convenience, a TxParams class is provided:

>>> from zero_ex.contract_wrappers import TxParams

Contract Addresses

The 0x-contract-addresses package (which is used by 0x-contract-wrappers and thus gets installed along with it) provides the addresses of the 0x contracts on each chain, including those that come pre-deployed deployed in the 0xorg/ganache-cli docker image. Let’s capture the addresses we’ll use throughout the examples below:

>>> 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

The examples below demonstrate constructing an order with the maker providing ZRX in exchange for the taker providing some WETH. For the order to be valid, our Taker first needs to wrap some ether as WETH.

First get an instance of the WETH contract on the network:

>>> from zero_ex.contract_artifacts import abi_by_name
>>> weth_instance = Web3(ganache).eth.contract(
...    address=Web3.toChecksumAddress(weth_address),
...    abi=abi_by_name("WETH9")
... )

Then have the Taker deposit some ETH into that contract, which will result in it receiving WETH:

>>> from eth_utils import to_wei
>>> weth_instance.functions.deposit().transact(
...     {"from": Web3.toChecksumAddress(taker_address),
...      "value": to_wei(1, 'ether')}
... )
HexBytes('0x...')

Approvals

In order to trade on 0x, one must approve the 0x smart contracts to transfer their tokens. Because the order constructed below has the maker giving WETH, we need to tell the WETH token contract to let the 0x contracts transfer our balance:

>>> from zero_ex.contract_wrappers.erc20_token import ERC20Token
>>> zrx_token = ERC20Token(
...     web3_or_provider=ganache,
...     contract_address=chain_to_addresses(ChainId.GANACHE).zrx_token,
... )
>>> weth_token = ERC20Token(
...     web3_or_provider=ganache,
...     contract_address=chain_to_addresses(ChainId.GANACHE).ether_token,
... )
>>> erc20_proxy_addr = chain_to_addresses(ChainId.GANACHE).erc20_proxy
>>> tx = zrx_token.approve.send_transaction(
...     erc20_proxy_addr,
...     to_wei(100, 'ether'),
...     tx_params=TxParams(from_=maker_address),
... )
>>> tx = weth_token.approve.send_transaction(
...     erc20_proxy_addr,
...     to_wei(100, 'ether'),
...     tx_params=TxParams(from_=taker_address),
... )

Constructing an order

>>> from zero_ex.contract_wrappers.exchange.types import Order
>>> from zero_ex.order_utils import asset_data_utils
>>> from datetime import datetime, timedelta
>>> import random
>>> order = Order(
...     makerAddress=maker_address,
...     takerAddress='0x0000000000000000000000000000000000000000',
...     senderAddress='0x0000000000000000000000000000000000000000',
...     feeRecipientAddress='0x0000000000000000000000000000000000000000',
...     makerAssetData=asset_data_utils.encode_erc20(zrx_address),
...     takerAssetData=asset_data_utils.encode_erc20(weth_address),
...     salt=random.randint(1, 100000000000000000),
...     makerFee=0,
...     takerFee=0,
...     makerAssetAmount=to_wei(0.1, 'ether'),
...     takerAssetAmount=to_wei(0.1, 'ether'),
...     expirationTimeSeconds=round(
...         (datetime.utcnow() + timedelta(days=1)).timestamp()
...     ),
...     makerFeeAssetData='0x',
...     takerFeeAssetData='0x',
... )

For this order to be valid, our Maker must sign a hash of it:

>>> from zero_ex.order_utils import generate_order_hash_hex
>>> order_hash_hex = generate_order_hash_hex(
...     order, exchange_address, Web3(ganache).eth.chainId
... )
>>> from zero_ex.order_utils import sign_hash
>>> maker_signature = sign_hash(
...     ganache, Web3.toChecksumAddress(maker_address), order_hash_hex
... )

Now our Maker can either deliver this order, along with his signature, directly to the taker, or he can choose to broadcast the order to a 0x Relayer. For more information on working with Relayers, see the documentation for 0x-sra-client.

Filling an order

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=chain_to_addresses(ChainId.GANACHE).exchange,
... )

But before filling an order, one may wish to check that it’s actually fillable:

>>> from zero_ex.contract_wrappers.exchange.types import OrderStatus
>>> OrderStatus(exchange.get_order_info.call(order)["orderStatus"])
<OrderStatus.FILLABLE: 3>

The takerAssetAmount parameter specifies the amount of tokens (in this case WETH) that the taker wants to fill. This example fills the order completely, but partial fills are possible too.

Note that sending value in the fill transaction is a way to pay the protocol fee. The value to send is a function of the gas price, so we’ll need some help in that determination:

>>> from web3.gas_strategies.rpc import rpc_gas_price_strategy
>>> web3 = Web3(ganache)
>>> web3.eth.setGasPriceStrategy(rpc_gas_price_strategy)

One may wish to first call the method in a read-only way, to ensure that it will not revert, and to validate that the return data is as expected:

>>> from pprint import pprint
>>> pprint(exchange.fill_order.call(
...     order=order,
...     taker_asset_fill_amount=order["takerAssetAmount"],
...     signature=maker_signature,
...     tx_params=TxParams(
...         from_=taker_address, value=web3.eth.generateGasPrice() * 150000
...     ),
... ))
{'makerAssetFilledAmount': 100000000000000000,
 'makerFeePaid': 0,
 'protocolFeePaid': ...,
 'takerAssetFilledAmount': 100000000000000000,
 'takerFeePaid': 0}

Finally, submit the transaction:

>>> tx_hash = exchange.fill_order.send_transaction(
...     order=order,
...     taker_asset_fill_amount=order["takerAssetAmount"],
...     signature=maker_signature,
...     tx_params=TxParams(
...         from_=taker_address, value=web3.eth.generateGasPrice() * 150000
...     )
... )

Once the transaction is mined, we can get the details of our exchange through the exchange wrapper:

>>> exchange.get_fill_event(tx_hash)
(AttributeDict({'args': ...({'makerAddress': ...}), 'event': 'Fill', ...}),)
>>> pprint(exchange.get_fill_event(tx_hash)[0].args.__dict__)
{'feeRecipientAddress': '0x0000000000000000000000000000000000000000',
 'makerAddress': '0x...',
 'makerAssetData': b...,
 'makerAssetFilledAmount': 100000000000000000,
 'makerFeeAssetData': b...,
 'makerFeePaid': 0,
 'orderHash': b...,
 'protocolFeePaid': ...,
 'senderAddress': '0x...',
 'takerAddress': '0x...',
 'takerAssetData': b...,
 'takerAssetFilledAmount': 100000000000000000,
 'takerFeeAssetData': b...,
 'takerFeePaid': 0}
>>> exchange.get_fill_event(tx_hash)[0].args.takerAssetFilledAmount
100000000000000000

Cancelling an order

A Maker can cancel an order that has yet to be filled.

>>> order = Order(
...     makerAddress=maker_address,
...     takerAddress='0x0000000000000000000000000000000000000000',
...     exchangeAddress=exchange_address,
...     senderAddress='0x0000000000000000000000000000000000000000',
...     feeRecipientAddress='0x0000000000000000000000000000000000000000',
...     makerAssetData=asset_data_utils.encode_erc20(weth_address),
...     makerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     takerAssetData=asset_data_utils.encode_erc20(weth_address),
...     takerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     salt=random.randint(1, 100000000000000000),
...     makerFee=0,
...     takerFee=0,
...     makerAssetAmount=1000000000000000000,
...     takerAssetAmount=500000000000000000000,
...     expirationTimeSeconds=round(
...         (datetime.utcnow() + timedelta(days=1)).timestamp()
...     )
... )
>>> tx_hash = exchange.cancel_order.send_transaction(
...     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.get_cancel_event(tx_hash)
(AttributeDict({'args': ...({'makerAddress': ...}), 'event': 'Cancel', ...}),)
>>> pprint(exchange.get_cancel_event(tx_hash)[0].args.__dict__)
{'feeRecipientAddress': '0x0000000000000000000000000000000000000000',
 'makerAddress': '0x...',
 'makerAssetData': b...,
 'orderHash': b...,
 'senderAddress': '0x...',
 'takerAssetData': b...}
>>> exchange.get_cancel_event(tx_hash)[0].args.feeRecipientAddress
'0x0000000000000000000000000000000000000000'

Batching orders

The Exchange contract can also process multiple orders at the same time. Here is an example where the taker fills two orders in one transaction:

>>> order_1 = Order(
...     makerAddress=maker_address,
...     takerAddress='0x0000000000000000000000000000000000000000',
...     senderAddress='0x0000000000000000000000000000000000000000',
...     feeRecipientAddress='0x0000000000000000000000000000000000000000',
...     makerAssetData=asset_data_utils.encode_erc20(zrx_address),
...     makerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     takerAssetData=asset_data_utils.encode_erc20(weth_address),
...     takerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     salt=random.randint(1, 100000000000000000),
...     makerFee=0,
...     takerFee=0,
...     makerAssetAmount=100,
...     takerAssetAmount=100,
...     expirationTimeSeconds=round(
...         (datetime.utcnow() + timedelta(days=1)).timestamp()
...     )
... )
>>> signature_1 = sign_hash(
...     ganache,
...     Web3.toChecksumAddress(maker_address),
...     generate_order_hash_hex(
...         order_1, exchange.contract_address, Web3(ganache).eth.chainId
...     ),
... )
>>> order_2 = Order(
...     makerAddress=maker_address,
...     takerAddress='0x0000000000000000000000000000000000000000',
...     senderAddress='0x0000000000000000000000000000000000000000',
...     feeRecipientAddress='0x0000000000000000000000000000000000000000',
...     makerAssetData=asset_data_utils.encode_erc20(zrx_address),
...     makerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     takerAssetData=asset_data_utils.encode_erc20(weth_address),
...     takerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...     salt=random.randint(1, 100000000000000000),
...     makerFee=0,
...     takerFee=0,
...     makerAssetAmount=200,
...     takerAssetAmount=200,
...     expirationTimeSeconds=round(
...         (datetime.utcnow() + timedelta(days=1)).timestamp()
...     )
... )
>>> signature_2 = sign_hash(
...     ganache,
...     Web3.toChecksumAddress(maker_address),
...     generate_order_hash_hex(
...         order_2, exchange.contract_address, Web3(ganache).eth.chainId
...     ),
... )

Fill order_1 and order_2 together:

>>> exchange.batch_fill_orders.send_transaction(
...     orders=[order_1, order_2],
...     taker_asset_fill_amounts=[1, 2],
...     signatures=[signature_1, signature_2],
...     tx_params=TxParams(
...         from_=taker_address,
...         value=2*web3.eth.generateGasPrice()*150000
...     )
... )
HexBytes('0x...')

Estimating gas consumption

Before executing a transaction, you may want to get an estimate of how much gas will be consumed.

>>> exchange.cancel_order.estimate_gas(
...     order=Order(
...         makerAddress=maker_address,
...         takerAddress='0x0000000000000000000000000000000000000000',
...         exchangeAddress=exchange_address,
...         senderAddress='0x0000000000000000000000000000000000000000',
...         feeRecipientAddress='0x0000000000000000000000000000000000000000',
...         makerAssetData=asset_data_utils.encode_erc20(weth_address),
...         makerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...         takerAssetData=asset_data_utils.encode_erc20(weth_address),
...         takerFeeAssetData=asset_data_utils.encode_erc20('0x' + '00'*20),
...         salt=random.randint(1, 100000000000000000),
...         makerFee=0,
...         takerFee=0,
...         makerAssetAmount=1000000000000000000,
...         takerAssetAmount=500000000000000000000,
...         expirationTimeSeconds=round(
...             (datetime.utcnow() + timedelta(days=1)).timestamp()
...         )
...     ),
...     tx_params=TxParams(from_=maker_address),
... )
74...

zero_ex.contract_wrappers.asset_proxy_owner

Generated wrapper for AssetProxyOwner Solidity contract.

class zero_ex.contract_wrappers.asset_proxy_owner.AddOwnerMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the addOwner method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows to add a new owner. Transaction has to be sent by wallet.

Parameters
  • owner (str) – Address of new owner.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows to add a new owner. Transaction has to be sent by wallet.

Parameters
  • owner (str) – Address of new owner.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(owner)[source]

Validate the inputs to the addOwner method.

class zero_ex.contract_wrappers.asset_proxy_owner.AssetProxyOwner(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for AssetProxyOwner Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[AssetProxyOwnerValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

add_owner = None

Constructor-initialized instance of AddOwnerMethod.

change_requirement = None

Constructor-initialized instance of ChangeRequirementMethod.

change_time_lock = None

Constructor-initialized instance of ChangeTimeLockMethod.

confirm_transaction = None

Constructor-initialized instance of ConfirmTransactionMethod.

confirmation_times = None

Constructor-initialized instance of ConfirmationTimesMethod.

confirmations = None

Constructor-initialized instance of ConfirmationsMethod.

execute_transaction = None

Constructor-initialized instance of ExecuteTransactionMethod.

function_call_time_locks = None

Constructor-initialized instance of FunctionCallTimeLocksMethod.

get_confirmation_count = None

Constructor-initialized instance of GetConfirmationCountMethod.

get_confirmation_event(tx_hash)[source]

Get log entry for Confirmation event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Confirmation event

Return type

Tuple[AttributeDict]

get_confirmation_time_set_event(tx_hash)[source]

Get log entry for ConfirmationTimeSet event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ConfirmationTimeSet event

Return type

Tuple[AttributeDict]

get_confirmations = None

Constructor-initialized instance of GetConfirmationsMethod.

get_deposit_event(tx_hash)[source]

Get log entry for Deposit event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Deposit event

Return type

Tuple[AttributeDict]

get_execution_event(tx_hash)[source]

Get log entry for Execution event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Execution event

Return type

Tuple[AttributeDict]

get_execution_failure_event(tx_hash)[source]

Get log entry for ExecutionFailure event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ExecutionFailure event

Return type

Tuple[AttributeDict]

get_function_call_time_lock_registration_event(tx_hash)[source]

Get log entry for FunctionCallTimeLockRegistration event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting FunctionCallTimeLockRegistration event

Return type

Tuple[AttributeDict]

get_owner_addition_event(tx_hash)[source]

Get log entry for OwnerAddition event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting OwnerAddition event

Return type

Tuple[AttributeDict]

get_owner_removal_event(tx_hash)[source]

Get log entry for OwnerRemoval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting OwnerRemoval event

Return type

Tuple[AttributeDict]

get_owners = None

Constructor-initialized instance of GetOwnersMethod.

get_requirement_change_event(tx_hash)[source]

Get log entry for RequirementChange event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting RequirementChange event

Return type

Tuple[AttributeDict]

get_revocation_event(tx_hash)[source]

Get log entry for Revocation event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Revocation event

Return type

Tuple[AttributeDict]

get_submission_event(tx_hash)[source]

Get log entry for Submission event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Submission event

Return type

Tuple[AttributeDict]

get_time_lock_change_event(tx_hash)[source]

Get log entry for TimeLockChange event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting TimeLockChange event

Return type

Tuple[AttributeDict]

get_transaction_count = None

Constructor-initialized instance of GetTransactionCountMethod.

get_transaction_ids = None

Constructor-initialized instance of GetTransactionIdsMethod.

is_confirmed = None

Constructor-initialized instance of IsConfirmedMethod.

is_owner = None

Constructor-initialized instance of IsOwnerMethod.

max_owner_count = None

Constructor-initialized instance of MaxOwnerCountMethod.

owners = None

Constructor-initialized instance of OwnersMethod.

register_function_call = None

Constructor-initialized instance of RegisterFunctionCallMethod.

remove_owner = None

Constructor-initialized instance of RemoveOwnerMethod.

replace_owner = None

Constructor-initialized instance of ReplaceOwnerMethod.

required = None

Constructor-initialized instance of RequiredMethod.

revoke_confirmation = None

Constructor-initialized instance of RevokeConfirmationMethod.

seconds_time_locked = None

Constructor-initialized instance of SecondsTimeLockedMethod.

submit_transaction = None

Constructor-initialized instance of SubmitTransactionMethod.

transaction_count = None

Constructor-initialized instance of TransactionCountMethod.

transactions = None

Constructor-initialized instance of TransactionsMethod.

class zero_ex.contract_wrappers.asset_proxy_owner.AssetProxyOwnerValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.asset_proxy_owner.ChangeRequirementMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the changeRequirement method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_required, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_required, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows to change the number of required confirmations. Transaction has to be sent by wallet.

Parameters
  • _required (int) – Number of required confirmations.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_required, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_required, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows to change the number of required confirmations. Transaction has to be sent by wallet.

Parameters
  • _required (int) – Number of required confirmations.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_required)[source]

Validate the inputs to the changeRequirement method.

class zero_ex.contract_wrappers.asset_proxy_owner.ChangeTimeLockMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the changeTimeLock method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_seconds_time_locked, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_seconds_time_locked, tx_params=None)[source]

Execute underlying contract method via eth_call.

Changes the duration of the time lock for transactions.

Parameters
  • _secondsTimeLocked – Duration needed after a transaction is confirmed and before it becomes executable, in seconds.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_seconds_time_locked, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_seconds_time_locked, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Changes the duration of the time lock for transactions.

Parameters
  • _secondsTimeLocked – Duration needed after a transaction is confirmed and before it becomes executable, in seconds.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_seconds_time_locked)[source]

Validate the inputs to the changeTimeLock method.

class zero_ex.contract_wrappers.asset_proxy_owner.ConfirmTransactionMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the confirmTransaction method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transaction_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows an owner to confirm a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows an owner to confirm a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the confirmTransaction method.

class zero_ex.contract_wrappers.asset_proxy_owner.ConfirmationTimesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the confirmationTimes method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the confirmationTimes method.

class zero_ex.contract_wrappers.asset_proxy_owner.ConfirmationsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the confirmations method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the confirmations method.

class zero_ex.contract_wrappers.asset_proxy_owner.ExecuteTransactionMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the executeTransaction method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transaction_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows anyone to execute a confirmed transaction. Transactions must encode the values with the signature “bytes[] data, address[] destinations, uint256[] values” The destination and value fields of the transaction in storage are ignored. All function calls must be successful or the entire call will revert.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows anyone to execute a confirmed transaction. Transactions must encode the values with the signature “bytes[] data, address[] destinations, uint256[] values” The destination and value fields of the transaction in storage are ignored. All function calls must be successful or the entire call will revert.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the executeTransaction method.

class zero_ex.contract_wrappers.asset_proxy_owner.FunctionCallTimeLocksMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the functionCallTimeLocks method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[bool, int]

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the functionCallTimeLocks method.

class zero_ex.contract_wrappers.asset_proxy_owner.GetConfirmationCountMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getConfirmationCount method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns number of confirmations of a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Number of confirmations.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the getConfirmationCount method.

class zero_ex.contract_wrappers.asset_proxy_owner.GetConfirmationsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getConfirmations method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns array with owner addresses, which confirmed transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

Returns array of owner addresses.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the getConfirmations method.

class zero_ex.contract_wrappers.asset_proxy_owner.GetOwnersMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getOwners method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns list of owners.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

List of owner addresses.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.asset_proxy_owner.GetTransactionCountMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTransactionCount method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(pending, executed, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns total number of transactions after filers are applied.

Parameters
  • executed (bool) – Include executed transactions.

  • pending (bool) – Include pending transactions.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Total number of transactions after filters are applied.

estimate_gas(pending, executed, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(pending, executed)[source]

Validate the inputs to the getTransactionCount method.

class zero_ex.contract_wrappers.asset_proxy_owner.GetTransactionIdsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTransactionIds method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_from, to, pending, executed, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns list of transaction IDs in defined range.

Parameters
  • executed (bool) – Include executed transactions.

  • from – Index start position of transaction array.

  • pending (bool) – Include pending transactions.

  • to (int) – Index end position of transaction array.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

Returns array of transaction IDs.

estimate_gas(_from, to, pending, executed, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_from, to, pending, executed)[source]

Validate the inputs to the getTransactionIds method.

class zero_ex.contract_wrappers.asset_proxy_owner.IsConfirmedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isConfirmed method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns the confirmation status of a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

Confirmation status.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the isConfirmed method.

class zero_ex.contract_wrappers.asset_proxy_owner.IsOwnerMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isOwner method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the isOwner method.

class zero_ex.contract_wrappers.asset_proxy_owner.MaxOwnerCountMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the MAX_OWNER_COUNT method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.asset_proxy_owner.OwnersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the owners method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the owners method.

class zero_ex.contract_wrappers.asset_proxy_owner.RegisterFunctionCallMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the registerFunctionCall method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(has_custom_time_lock, function_selector, destination, new_seconds_time_locked, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(has_custom_time_lock, function_selector, destination, new_seconds_time_locked, tx_params=None)[source]

Execute underlying contract method via eth_call.

Registers a custom timelock to a specific function selector / destination combo

Parameters
  • destination (str) – Address of destination where function will be called.

  • functionSelector – 4 byte selector of registered function.

  • hasCustomTimeLock – True if timelock is custom.

  • newSecondsTimeLocked – Duration in seconds needed after a transaction is confirmed to become executable.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(has_custom_time_lock, function_selector, destination, new_seconds_time_locked, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(has_custom_time_lock, function_selector, destination, new_seconds_time_locked, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Registers a custom timelock to a specific function selector / destination combo

Parameters
  • destination (str) – Address of destination where function will be called.

  • functionSelector – 4 byte selector of registered function.

  • hasCustomTimeLock – True if timelock is custom.

  • newSecondsTimeLocked – Duration in seconds needed after a transaction is confirmed to become executable.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(has_custom_time_lock, function_selector, destination, new_seconds_time_locked)[source]

Validate the inputs to the registerFunctionCall method.

class zero_ex.contract_wrappers.asset_proxy_owner.RemoveOwnerMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeOwner method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows to remove an owner. Transaction has to be sent by wallet.

Parameters
  • owner (str) – Address of owner.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows to remove an owner. Transaction has to be sent by wallet.

Parameters
  • owner (str) – Address of owner.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(owner)[source]

Validate the inputs to the removeOwner method.

class zero_ex.contract_wrappers.asset_proxy_owner.ReplaceOwnerMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the replaceOwner method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(owner, new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(owner, new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows to replace an owner with a new owner. Transaction has to be sent by wallet.

Parameters
  • newOwner – Address of new owner.

  • owner (str) – Address of owner to be replaced.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(owner, new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(owner, new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows to replace an owner with a new owner. Transaction has to be sent by wallet.

Parameters
  • newOwner – Address of new owner.

  • owner (str) – Address of owner to be replaced.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(owner, new_owner)[source]

Validate the inputs to the replaceOwner method.

class zero_ex.contract_wrappers.asset_proxy_owner.RequiredMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the required method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.asset_proxy_owner.RevokeConfirmationMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the revokeConfirmation method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transaction_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows an owner to revoke a confirmation for a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(transaction_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transaction_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows an owner to revoke a confirmation for a transaction.

Parameters
  • transactionId – Transaction ID.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transaction_id)[source]

Validate the inputs to the revokeConfirmation method.

class zero_ex.contract_wrappers.asset_proxy_owner.SecondsTimeLockedMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the secondsTimeLocked method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.asset_proxy_owner.SubmitTransactionMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the submitTransaction method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(destination, value, data, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(destination, value, data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows an owner to submit and confirm a transaction.

Parameters
  • data (Union[bytes, str]) – Transaction data payload.

  • destination (str) – Transaction target address.

  • value (int) – Transaction ether value.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

the return value of the underlying method.

estimate_gas(destination, value, data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(destination, value, data, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows an owner to submit and confirm a transaction.

Parameters
  • data (Union[bytes, str]) – Transaction data payload.

  • destination (str) – Transaction target address.

  • value (int) – Transaction ether value.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(destination, value, data)[source]

Validate the inputs to the submitTransaction method.

class zero_ex.contract_wrappers.asset_proxy_owner.TransactionCountMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the transactionCount method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.asset_proxy_owner.TransactionsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transactions method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[str, int, Union[bytes, str], bool]

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the transactions method.

zero_ex.contract_wrappers.coordinator

Generated wrapper for Coordinator Solidity contract.

class zero_ex.contract_wrappers.coordinator.AssertValidCoordinatorApprovalsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the assertValidCoordinatorApprovals method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Validates that the 0x transaction has been approved by all of the feeRecipients that correspond to each order in the transaction’s Exchange calldata.

Parameters
  • approvalSignatures – Array of signatures that correspond to the feeRecipients of each order in the transaction’s Exchange calldata.

  • transaction (LibZeroExTransactionZeroExTransaction) – 0x transaction containing salt, signerAddress, and data.

  • transactionSignature – Proof that the transaction has been signed by the signer.

  • txOrigin – Required signer of Ethereum transaction calling this function.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

estimate_gas(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction, tx_origin, transaction_signature, approval_signatures)[source]

Validate the inputs to the assertValidCoordinatorApprovals method.

class zero_ex.contract_wrappers.coordinator.Coordinator(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for Coordinator Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[CoordinatorValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

assert_valid_coordinator_approvals = None

Constructor-initialized instance of AssertValidCoordinatorApprovalsMethod.

decode_orders_from_fill_data = None

Constructor-initialized instance of DecodeOrdersFromFillDataMethod.

eip712_coordinator_approval_schema_hash = None

Constructor-initialized instance of Eip712CoordinatorApprovalSchemaHashMethod.

eip712_coordinator_domain_hash = None

Constructor-initialized instance of Eip712CoordinatorDomainHashMethod.

eip712_coordinator_domain_name = None

Constructor-initialized instance of Eip712CoordinatorDomainNameMethod.

eip712_coordinator_domain_version = None

Constructor-initialized instance of Eip712CoordinatorDomainVersionMethod.

eip712_exchange_domain_hash = None

Constructor-initialized instance of Eip712ExchangeDomainHashMethod.

execute_transaction = None

Constructor-initialized instance of ExecuteTransactionMethod.

get_coordinator_approval_hash = None

Constructor-initialized instance of GetCoordinatorApprovalHashMethod.

get_signer_address = None

Constructor-initialized instance of GetSignerAddressMethod.

class zero_ex.contract_wrappers.coordinator.CoordinatorValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.coordinator.DecodeOrdersFromFillDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeOrdersFromFillData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decodes the orders from Exchange calldata representing any fill method.

Parameters
  • data (Union[bytes, str]) – Exchange calldata representing a fill method.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[LibOrderOrder]

Returns

orders The orders from the Exchange calldata.

estimate_gas(data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(data)[source]

Validate the inputs to the decodeOrdersFromFillData method.

class zero_ex.contract_wrappers.coordinator.Eip712CoordinatorApprovalSchemaHashMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.coordinator.Eip712CoordinatorDomainHashMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_COORDINATOR_DOMAIN_HASH method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.coordinator.Eip712CoordinatorDomainNameMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_COORDINATOR_DOMAIN_NAME method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.coordinator.Eip712CoordinatorDomainVersionMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_COORDINATOR_DOMAIN_VERSION method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.coordinator.Eip712ExchangeDomainHashMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_EXCHANGE_DOMAIN_HASH method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.coordinator.ExecuteTransactionMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the executeTransaction method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction’s Exchange calldata.

Parameters
  • approvalSignatures – Array of signatures that correspond to the feeRecipients of each order in the transaction’s Exchange calldata.

  • transaction (LibZeroExTransactionZeroExTransaction) – 0x transaction containing salt, signerAddress, and data.

  • transactionSignature – Proof that the transaction has been signed by the signer.

  • txOrigin – Required signer of Ethereum transaction calling this function.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transaction, tx_origin, transaction_signature, approval_signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction’s Exchange calldata.

Parameters
  • approvalSignatures – Array of signatures that correspond to the feeRecipients of each order in the transaction’s Exchange calldata.

  • transaction (LibZeroExTransactionZeroExTransaction) – 0x transaction containing salt, signerAddress, and data.

  • transactionSignature – Proof that the transaction has been signed by the signer.

  • txOrigin – Required signer of Ethereum transaction calling this function.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transaction, tx_origin, transaction_signature, approval_signatures)[source]

Validate the inputs to the executeTransaction method.

class zero_ex.contract_wrappers.coordinator.GetCoordinatorApprovalHashMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getCoordinatorApprovalHash method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(approval, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calculates the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.

Parameters
  • approval (LibCoordinatorApprovalCoordinatorApproval) – Coordinator approval message containing the transaction hash, and transaction signature.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

approvalHash EIP712 hash of the Coordinator approval message with the domain separator of this contract.

estimate_gas(approval, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(approval)[source]

Validate the inputs to the getCoordinatorApprovalHash method.

class zero_ex.contract_wrappers.coordinator.GetSignerAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getSignerAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_hash, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Recovers the address of a signer given a hash and signature.

Parameters
  • hash – Any 32 byte hash.

  • signature (Union[bytes, str]) – Proof that the hash has been signed by signer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

signerAddress Address of the signer.

estimate_gas(_hash, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_hash, signature)[source]

Validate the inputs to the getSignerAddress method.

zero_ex.contract_wrappers.coordinator_registry

Generated wrapper for CoordinatorRegistry Solidity contract.

class zero_ex.contract_wrappers.coordinator_registry.CoordinatorRegistry(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for CoordinatorRegistry Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[CoordinatorRegistryValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

get_coordinator_endpoint = None

Constructor-initialized instance of GetCoordinatorEndpointMethod.

get_coordinator_endpoint_set_event(tx_hash)[source]

Get log entry for CoordinatorEndpointSet event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting CoordinatorEndpointSet event

Return type

Tuple[AttributeDict]

set_coordinator_endpoint = None

Constructor-initialized instance of SetCoordinatorEndpointMethod.

class zero_ex.contract_wrappers.coordinator_registry.CoordinatorRegistryValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.coordinator_registry.GetCoordinatorEndpointMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getCoordinatorEndpoint method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(coordinator_operator, tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the endpoint for a Coordinator.

Parameters
  • coordinatorOperator – Operator of the Coordinator endpoint.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

coordinatorEndpoint Endpoint of the Coordinator as a string.

estimate_gas(coordinator_operator, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(coordinator_operator)[source]

Validate the inputs to the getCoordinatorEndpoint method.

class zero_ex.contract_wrappers.coordinator_registry.SetCoordinatorEndpointMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setCoordinatorEndpoint method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(coordinator_endpoint, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(coordinator_endpoint, tx_params=None)[source]

Execute underlying contract method via eth_call.

Called by a Coordinator operator to set the endpoint of their Coordinator.

Parameters
  • coordinatorEndpoint – Endpoint of the Coordinator as a string.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(coordinator_endpoint, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(coordinator_endpoint, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Called by a Coordinator operator to set the endpoint of their Coordinator.

Parameters
  • coordinatorEndpoint – Endpoint of the Coordinator as a string.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(coordinator_endpoint)[source]

Validate the inputs to the setCoordinatorEndpoint method.

zero_ex.contract_wrappers.dev_utils

Generated wrapper for DevUtils Solidity contract.

class zero_ex.contract_wrappers.dev_utils.DecodeAssetProxyDispatchErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeAssetProxyDispatchError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded AssetProxyDispatchError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, Union[bytes, str], Union[bytes, str]]

Returns

errorCode The error code.orderHash Hash of the order being dispatched.assetData Asset data of the order being dispatched.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeAssetProxyDispatchError method.

class zero_ex.contract_wrappers.dev_utils.DecodeAssetProxyExistsErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeAssetProxyExistsError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded AssetProxyExistsError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str]

Returns

assetProxyId Id of asset proxy.assetProxyAddress The address of the asset proxy.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeAssetProxyExistsError method.

class zero_ex.contract_wrappers.dev_utils.DecodeAssetProxyIdMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeAssetProxyId method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode AssetProxy identifier

Parameters
  • assetData – AssetProxy-compliant asset data describing an ERC-20, ERC-721, ERC1155, or MultiAsset asset.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

The AssetProxy identifier

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeAssetProxyId method.

class zero_ex.contract_wrappers.dev_utils.DecodeAssetProxyTransferErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeAssetProxyTransferError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded AssetProxyTransferError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], Union[bytes, str], Union[bytes, str]]

Returns

orderHash Hash of the order being dispatched.assetData Asset data of the order being dispatched.errorData ABI-encoded revert data from the asset proxy.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeAssetProxyTransferError method.

class zero_ex.contract_wrappers.dev_utils.DecodeEip1271SignatureErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeEIP1271SignatureError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded SignatureValidatorError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[str, Union[bytes, str], Union[bytes, str], Union[bytes, str]]

Returns

signerAddress The expected signer of the hash.signature The full signature bytes.errorData The revert data thrown by the validator contract.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeEIP1271SignatureError method.

class zero_ex.contract_wrappers.dev_utils.DecodeErc1155AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeERC1155AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode ERC-1155 asset data from the format described in the AssetProxy contract specification.

Parameters
  • assetData – AssetProxy-compliant asset data describing an ERC- 1155 set of assets.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str, List[int], List[int], Union[bytes, str]]

Returns

The ERC-1155 AssetProxy identifier, the address of the ERC- 1155 contract hosting the assets, an array of the identifiers of the assets to be traded, an array of asset amounts to be traded, and callback data. Each element of the arrays corresponds to the same-indexed element of the other array. Return values specified as memory are returned as pointers to locations within the memory of the input parameter assetData.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeERC1155AssetData method.

class zero_ex.contract_wrappers.dev_utils.DecodeErc20AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeERC20AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode ERC-20 asset data from the format described in the AssetProxy contract specification.

Parameters
  • assetData – AssetProxy-compliant asset data describing an ERC-20 asset.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str]

Returns

The AssetProxy identifier, and the address of the ERC-20 contract hosting this asset.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeERC20AssetData method.

class zero_ex.contract_wrappers.dev_utils.DecodeErc721AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeERC721AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode ERC-721 asset data from the format described in the AssetProxy contract specification.

Parameters
  • assetData – AssetProxy-compliant asset data describing an ERC-721 asset.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str, int]

Returns

The ERC-721 AssetProxy identifier, the address of the ERC-721 contract hosting this asset, and the identifier of the specific asset to be traded.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeERC721AssetData method.

class zero_ex.contract_wrappers.dev_utils.DecodeExchangeInvalidContextErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeExchangeInvalidContextError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded OrderStatusError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, Union[bytes, str], str]

Returns

errorCode Error code that corresponds to invalid maker, taker, or sender.orderHash The order hash.contextAddress The maker, taker, or sender address

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeExchangeInvalidContextError method.

class zero_ex.contract_wrappers.dev_utils.DecodeFillErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeFillError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded FillError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, Union[bytes, str]]

Returns

errorCode The error code.orderHash The order hash.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeFillError method.

class zero_ex.contract_wrappers.dev_utils.DecodeIncompleteFillErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeIncompleteFillError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded IncompleteFillError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, int, int]

Returns

orderHash Hash of the order being filled.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeIncompleteFillError method.

class zero_ex.contract_wrappers.dev_utils.DecodeMultiAssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeMultiAssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode multi-asset data from the format described in the AssetProxy contract specification.

Parameters
  • assetData – AssetProxy-compliant data describing a multi-asset basket.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], List[int], List[Union[bytes, str]]]

Returns

The Multi-Asset AssetProxy identifier, an array of the amounts of the assets to be traded, and an array of the AssetProxy- compliant data describing each asset to be traded. Each element of the arrays corresponds to the same-indexed element of the other array.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeMultiAssetData method.

class zero_ex.contract_wrappers.dev_utils.DecodeNegativeSpreadErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeNegativeSpreadError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded NegativeSpreadError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], Union[bytes, str]]

Returns

leftOrderHash Hash of the left order being matched.rightOrderHash Hash of the right order being matched.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeNegativeSpreadError method.

class zero_ex.contract_wrappers.dev_utils.DecodeOrderEpochErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeOrderEpochError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded OrderEpochError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[str, str, int]

Returns

makerAddress The order maker.orderSenderAddress The order sender.currentEpoch The current epoch for the maker.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeOrderEpochError method.

class zero_ex.contract_wrappers.dev_utils.DecodeOrderStatusErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeOrderStatusError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded OrderStatusError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], int]

Returns

orderHash The order hash.orderStatus The order status.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeOrderStatusError method.

class zero_ex.contract_wrappers.dev_utils.DecodeSignatureErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeSignatureError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded SignatureError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, Union[bytes, str], str, Union[bytes, str]]

Returns

errorCode The error code.signerAddress The expected signer of the hash.signature The full signature.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeSignatureError method.

class zero_ex.contract_wrappers.dev_utils.DecodeSignatureValidatorNotApprovedErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeSignatureValidatorNotApprovedError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded SignatureValidatorNotApprovedError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[str, str]

Returns

signerAddress The expected signer of the hash.validatorAddress The expected validator.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeSignatureValidatorNotApprovedError method.

class zero_ex.contract_wrappers.dev_utils.DecodeSignatureWalletErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeSignatureWalletError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded SignatureWalletError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str, Union[bytes, str], Union[bytes, str]]

Returns

errorCode The error code.signerAddress The expected signer of the hash.signature The full signature bytes.errorData The revert data thrown by the validator contract.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeSignatureWalletError method.

class zero_ex.contract_wrappers.dev_utils.DecodeStaticCallAssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeStaticCallAssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decode StaticCall asset data from the format described in the AssetProxy contract specification.

Parameters
  • assetData – AssetProxy-compliant asset data describing a StaticCall asset

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], str, Union[bytes, str], Union[bytes, str]]

Returns

The StaticCall AssetProxy identifier, the target address of the StaticCAll, the data to be passed to the target address, and the expected Keccak-256 hash of the static call return data.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the decodeStaticCallAssetData method.

class zero_ex.contract_wrappers.dev_utils.DecodeTransactionErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeTransactionError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded TransactionError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, Union[bytes, str]]

Returns

errorCode The error code.transactionHash Hash of the transaction.

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeTransactionError method.

class zero_ex.contract_wrappers.dev_utils.DecodeTransactionExecutionErrorMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeTransactionExecutionError method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(encoded, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decompose an ABI-encoded TransactionExecutionError.

Parameters
  • encoded (Union[bytes, str]) – ABI-encoded revert error.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Union[bytes, str], Union[bytes, str]]

Returns

transactionHash Hash of the transaction.errorData Error thrown by exeucteTransaction().

estimate_gas(encoded, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(encoded)[source]

Validate the inputs to the decodeTransactionExecutionError method.

class zero_ex.contract_wrappers.dev_utils.DecodeZeroExTransactionDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the decodeZeroExTransactionData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Decodes the call data for an Exchange contract method call.

Parameters
  • transactionData – ABI-encoded calldata for an Exchange contract method call.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[str, List[LibOrderOrder], List[int], List[Union[bytes, str]]]

Returns

The name of the function called, and the parameters it was given. For single-order fills and cancels, the arrays will have just one element.

estimate_gas(transaction_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction_data)[source]

Validate the inputs to the decodeZeroExTransactionData method.

class zero_ex.contract_wrappers.dev_utils.DevUtils(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for DevUtils Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[DevUtilsValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

decode_asset_proxy_dispatch_error = None

Constructor-initialized instance of DecodeAssetProxyDispatchErrorMethod.

decode_asset_proxy_exists_error = None

Constructor-initialized instance of DecodeAssetProxyExistsErrorMethod.

decode_asset_proxy_id = None

Constructor-initialized instance of DecodeAssetProxyIdMethod.

decode_asset_proxy_transfer_error = None

Constructor-initialized instance of DecodeAssetProxyTransferErrorMethod.

decode_eip1271_signature_error = None

Constructor-initialized instance of DecodeEip1271SignatureErrorMethod.

decode_erc1155_asset_data = None

Constructor-initialized instance of DecodeErc1155AssetDataMethod.

decode_erc20_asset_data = None

Constructor-initialized instance of DecodeErc20AssetDataMethod.

decode_erc721_asset_data = None

Constructor-initialized instance of DecodeErc721AssetDataMethod.

decode_exchange_invalid_context_error = None

Constructor-initialized instance of DecodeExchangeInvalidContextErrorMethod.

decode_fill_error = None

Constructor-initialized instance of DecodeFillErrorMethod.

decode_incomplete_fill_error = None

Constructor-initialized instance of DecodeIncompleteFillErrorMethod.

decode_multi_asset_data = None

Constructor-initialized instance of DecodeMultiAssetDataMethod.

decode_negative_spread_error = None

Constructor-initialized instance of DecodeNegativeSpreadErrorMethod.

decode_order_epoch_error = None

Constructor-initialized instance of DecodeOrderEpochErrorMethod.

decode_order_status_error = None

Constructor-initialized instance of DecodeOrderStatusErrorMethod.

decode_signature_error = None

Constructor-initialized instance of DecodeSignatureErrorMethod.

decode_signature_validator_not_approved_error = None

Constructor-initialized instance of DecodeSignatureValidatorNotApprovedErrorMethod.

decode_signature_wallet_error = None

Constructor-initialized instance of DecodeSignatureWalletErrorMethod.

decode_static_call_asset_data = None

Constructor-initialized instance of DecodeStaticCallAssetDataMethod.

decode_transaction_error = None

Constructor-initialized instance of DecodeTransactionErrorMethod.

decode_transaction_execution_error = None

Constructor-initialized instance of DecodeTransactionExecutionErrorMethod.

decode_zero_ex_transaction_data = None

Constructor-initialized instance of DecodeZeroExTransactionDataMethod.

eip712_exchange_domain_hash = None

Constructor-initialized instance of Eip712ExchangeDomainHashMethod.

encode_erc1155_asset_data = None

Constructor-initialized instance of EncodeErc1155AssetDataMethod.

encode_erc20_asset_data = None

Constructor-initialized instance of EncodeErc20AssetDataMethod.

encode_erc721_asset_data = None

Constructor-initialized instance of EncodeErc721AssetDataMethod.

encode_multi_asset_data = None

Constructor-initialized instance of EncodeMultiAssetDataMethod.

encode_static_call_asset_data = None

Constructor-initialized instance of EncodeStaticCallAssetDataMethod.

get_asset_proxy_allowance = None

Constructor-initialized instance of GetAssetProxyAllowanceMethod.

get_balance = None

Constructor-initialized instance of GetBalanceMethod.

get_balance_and_asset_proxy_allowance = None

Constructor-initialized instance of GetBalanceAndAssetProxyAllowanceMethod.

get_batch_asset_proxy_allowances = None

Constructor-initialized instance of GetBatchAssetProxyAllowancesMethod.

get_batch_balances = None

Constructor-initialized instance of GetBatchBalancesMethod.

get_batch_balances_and_asset_proxy_allowances = None

Constructor-initialized instance of GetBatchBalancesAndAssetProxyAllowancesMethod.

get_eth_balances = None

Constructor-initialized instance of GetEthBalancesMethod.

get_order_hash = None

Constructor-initialized instance of GetOrderHashMethod.

get_order_relevant_state = None

Constructor-initialized instance of GetOrderRelevantStateMethod.

get_order_relevant_states = None

Constructor-initialized instance of GetOrderRelevantStatesMethod.

get_simulated_order_transfer_results = None

Constructor-initialized instance of GetSimulatedOrderTransferResultsMethod.

get_simulated_orders_transfer_results = None

Constructor-initialized instance of GetSimulatedOrdersTransferResultsMethod.

get_transaction_hash = None

Constructor-initialized instance of GetTransactionHashMethod.

get_transferable_asset_amount = None

Constructor-initialized instance of GetTransferableAssetAmountMethod.

revert_if_invalid_asset_data = None

Constructor-initialized instance of RevertIfInvalidAssetDataMethod.

class zero_ex.contract_wrappers.dev_utils.DevUtilsValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.dev_utils.Eip712ExchangeDomainHashMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_EXCHANGE_DOMAIN_HASH method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.dev_utils.EncodeErc1155AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the encodeERC1155AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(token_address, token_ids, token_values, callback_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Encode ERC-1155 asset data into the format described in the AssetProxy contract specification.

Parameters
  • callbackData – Data to be passed to receiving contracts when a transfer is performed.

  • tokenAddress – The address of the ERC-1155 contract hosting the asset(s) to be traded.

  • tokenIds – The identifiers of the specific assets to be traded.

  • tokenValues – The amounts of each asset to be traded.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

AssetProxy-compliant asset data describing the set of assets.

estimate_gas(token_address, token_ids, token_values, callback_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(token_address, token_ids, token_values, callback_data)[source]

Validate the inputs to the encodeERC1155AssetData method.

class zero_ex.contract_wrappers.dev_utils.EncodeErc20AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the encodeERC20AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(token_address, tx_params=None)[source]

Execute underlying contract method via eth_call.

Encode ERC-20 asset data into the format described in the AssetProxy contract specification.

Parameters
  • tokenAddress – The address of the ERC-20 contract hosting the asset to be traded.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

AssetProxy-compliant data describing the asset.

estimate_gas(token_address, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(token_address)[source]

Validate the inputs to the encodeERC20AssetData method.

class zero_ex.contract_wrappers.dev_utils.EncodeErc721AssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the encodeERC721AssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(token_address, token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Encode ERC-721 asset data into the format described in the AssetProxy specification.

Parameters
  • tokenAddress – The address of the ERC-721 contract hosting the asset to be traded.

  • tokenId – The identifier of the specific asset to be traded.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

AssetProxy-compliant asset data describing the asset.

estimate_gas(token_address, token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(token_address, token_id)[source]

Validate the inputs to the encodeERC721AssetData method.

class zero_ex.contract_wrappers.dev_utils.EncodeMultiAssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the encodeMultiAssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(amounts, nested_asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Encode data for multiple assets, per the AssetProxy contract specification.

Parameters
  • amounts (List[int]) – The amounts of each asset to be traded.

  • nestedAssetData – AssetProxy-compliant data describing each asset to be traded.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

AssetProxy-compliant data describing the set of assets.

estimate_gas(amounts, nested_asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(amounts, nested_asset_data)[source]

Validate the inputs to the encodeMultiAssetData method.

class zero_ex.contract_wrappers.dev_utils.EncodeStaticCallAssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the encodeStaticCallAssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(static_call_target_address, static_call_data, expected_return_data_hash, tx_params=None)[source]

Execute underlying contract method via eth_call.

Encode StaticCall asset data into the format described in the AssetProxy contract specification.

Parameters
  • expectedReturnDataHash – Expected Keccak-256 hash of the StaticCall return data.

  • staticCallData – Data that will be passed to staticCallTargetAddress in the StaticCall.

  • staticCallTargetAddress – Target address of StaticCall.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

AssetProxy-compliant asset data describing the set of assets.

estimate_gas(static_call_target_address, static_call_data, expected_return_data_hash, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(static_call_target_address, static_call_data, expected_return_data_hash)[source]

Validate the inputs to the encodeStaticCallAssetData method.

class zero_ex.contract_wrappers.dev_utils.GetAssetProxyAllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getAssetProxyAllowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns the number of asset(s) (described by assetData) that the corresponding AssetProxy contract is authorized to spend. When the asset data contains multiple assets (eg for Multi-Asset), the return value indicates how many complete “baskets” of those assets may be spent by all of the corresponding AssetProxy contracts.

Parameters
  • assetData – Details of asset, encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getAssetProxyAllowance method.

class zero_ex.contract_wrappers.dev_utils.GetBalanceAndAssetProxyAllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBalanceAndAssetProxyAllowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls getBalance() and getAllowance() for assetData.

Parameters
  • assetData – Details of asset, encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, int]

Returns

Number of assets (or asset baskets) held by owner, and number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getBalanceAndAssetProxyAllowance method.

class zero_ex.contract_wrappers.dev_utils.GetBalanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBalance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns the owner’s balance of the assets(s) specified in assetData. When the asset data contains multiple assets (eg in ERC1155 or Multi- Asset), the return value indicates how many complete “baskets” of those assets are owned by owner.

Parameters
  • assetData – Details of asset, encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Number of assets (or asset baskets) held by owner.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getBalance method.

class zero_ex.contract_wrappers.dev_utils.GetBatchAssetProxyAllowancesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBatchAssetProxyAllowances method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls getAssetProxyAllowance() for each element of assetData.

Parameters
  • assetData – Array of asset details, each encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

An array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getBatchAssetProxyAllowances method.

class zero_ex.contract_wrappers.dev_utils.GetBatchBalancesAndAssetProxyAllowancesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBatchBalancesAndAssetProxyAllowances method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls getBatchBalances() and getBatchAllowances() for each element of assetData.

Parameters
  • assetData – Array of asset details, each encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[List[int], List[int]]

Returns

An array of asset balances from getBalance(), and an array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getBatchBalancesAndAssetProxyAllowances method.

class zero_ex.contract_wrappers.dev_utils.GetBatchBalancesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBatchBalances method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls getBalance() for each element of assetData.

Parameters
  • assetData – Array of asset details, each encoded per the AssetProxy contract specification.

  • ownerAddress – Owner of the assets specified by assetData.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

Array of asset balances from getBalance(), with each element corresponding to the same-indexed element in the assetData input.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getBatchBalances method.

class zero_ex.contract_wrappers.dev_utils.GetEthBalancesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getEthBalances method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(addresses, tx_params=None)[source]

Execute underlying contract method via eth_call.

Batch fetches ETH balances

Parameters
  • addresses (List[str]) – Array of addresses.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

Array of ETH balances.

estimate_gas(addresses, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(addresses)[source]

Validate the inputs to the getEthBalances method.

class zero_ex.contract_wrappers.dev_utils.GetOrderHashMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrderHash method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, chain_id, exchange, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(order, chain_id, exchange, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order, chain_id, exchange)[source]

Validate the inputs to the getOrderHash method.

class zero_ex.contract_wrappers.dev_utils.GetOrderRelevantStateMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrderRelevantState method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Fetches all order-relevant information needed to validate if the supplied order is fillable.

Parameters
  • order (LibOrderOrder) – The order structure.

  • signature (Union[bytes, str]) – Signature provided by maker that proves the order’s authenticity. 0x01 can always be provided if the signature does not need to be validated.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[LibOrderOrderInfo, int, bool]

Returns

The orderInfo (hash, status, and takerAssetAmount already filled for the given order), fillableTakerAssetAmount (amount of the order’s takerAssetAmount that is fillable given all on-chain state), and isValidSignature (validity of the provided signature). NOTE: If the takerAssetData encodes data for multiple assets, fillableTakerAssetAmount will represent a “scaled” amount, meaning it must be multiplied by all the individual asset amounts within the takerAssetData to get the final amount of each asset that can be filled.

estimate_gas(order, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order, signature)[source]

Validate the inputs to the getOrderRelevantState method.

class zero_ex.contract_wrappers.dev_utils.GetOrderRelevantStatesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrderRelevantStates method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(orders, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Fetches all order-relevant information needed to validate if the supplied orders are fillable.

Parameters
  • orders (List[LibOrderOrder]) – Array of order structures.

  • signatures (List[Union[bytes, str]]) – Array of signatures provided by makers that prove the authenticity of the orders. 0x01 can always be provided if a signature does not need to be validated.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[List[LibOrderOrderInfo], List[int], List[bool]]

Returns

The ordersInfo (array of the hash, status, and takerAssetAmount already filled for each order), fillableTakerAssetAmounts (array of amounts for each order’s takerAssetAmount that is fillable given all on-chain state), and isValidSignature (array containing the validity of each provided signature). NOTE: If the takerAssetData encodes data for multiple assets, each element of fillableTakerAssetAmounts will represent a “scaled” amount, meaning it must be multiplied by all the individual asset amounts within the takerAssetData to get the final amount of each asset that can be filled.

estimate_gas(orders, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(orders, signatures)[source]

Validate the inputs to the getOrderRelevantStates method.

class zero_ex.contract_wrappers.dev_utils.GetSimulatedOrderTransferResultsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getSimulatedOrderTransferResults method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(order, taker_address, taker_asset_fill_amount, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(order, taker_address, taker_asset_fill_amount, tx_params=None)[source]

Execute underlying contract method via eth_call.

Simulates all of the transfers within an order and returns the index of the first failed transfer.

Parameters
  • order (LibOrderOrder) – The order to simulate transfers for.

  • takerAddress – The address of the taker that will fill the order.

  • takerAssetFillAmount – The amount of takerAsset that the taker wished to fill.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

the return value of the underlying method.

estimate_gas(order, taker_address, taker_asset_fill_amount, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(order, taker_address, taker_asset_fill_amount, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Simulates all of the transfers within an order and returns the index of the first failed transfer.

Parameters
  • order (LibOrderOrder) – The order to simulate transfers for.

  • takerAddress – The address of the taker that will fill the order.

  • takerAssetFillAmount – The amount of takerAsset that the taker wished to fill.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(order, taker_address, taker_asset_fill_amount)[source]

Validate the inputs to the getSimulatedOrderTransferResults method.

class zero_ex.contract_wrappers.dev_utils.GetSimulatedOrdersTransferResultsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getSimulatedOrdersTransferResults method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_addresses, taker_asset_fill_amounts, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_addresses, taker_asset_fill_amounts, tx_params=None)[source]

Execute underlying contract method via eth_call.

Simulates all of the transfers for each given order and returns the indices of each first failed transfer.

Parameters
  • orders (List[LibOrderOrder]) – Array of orders to individually simulate transfers for.

  • takerAddresses – Array of addresses of takers that will fill each order.

  • takerAssetFillAmounts – Array of amounts of takerAsset that will be filled for each order.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

the return value of the underlying method.

estimate_gas(orders, taker_addresses, taker_asset_fill_amounts, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_addresses, taker_asset_fill_amounts, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Simulates all of the transfers for each given order and returns the indices of each first failed transfer.

Parameters
  • orders (List[LibOrderOrder]) – Array of orders to individually simulate transfers for.

  • takerAddresses – Array of addresses of takers that will fill each order.

  • takerAssetFillAmounts – Array of amounts of takerAsset that will be filled for each order.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_addresses, taker_asset_fill_amounts)[source]

Validate the inputs to the getSimulatedOrdersTransferResults method.

class zero_ex.contract_wrappers.dev_utils.GetTransactionHashMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTransactionHash method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction, chain_id, exchange, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(transaction, chain_id, exchange, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction, chain_id, exchange)[source]

Validate the inputs to the getTransactionHash method.

class zero_ex.contract_wrappers.dev_utils.GetTransferableAssetAmountMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTransferableAssetAmount method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner_address, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the amount of an asset transferable by the owner.

Parameters
  • assetData – Description of tokens, per the AssetProxy contract specification.

  • ownerAddress – Address of the owner of the asset.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

The amount of the asset tranferable by the owner. NOTE: If the assetData encodes data for multiple assets, the transferableAssetAmount will represent the amount of times the entire assetData can be transferred. To calculate the total individual transferable amounts, this scaled transferableAmount must be multiplied by the individual asset amounts located within the assetData.

estimate_gas(owner_address, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner_address, asset_data)[source]

Validate the inputs to the getTransferableAssetAmount method.

class zero_ex.contract_wrappers.dev_utils.RevertIfInvalidAssetDataMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the revertIfInvalidAssetData method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the revertIfInvalidAssetData method.

zero_ex.contract_wrappers.dutch_auction

Generated wrapper for DutchAuction Solidity contract.

class zero_ex.contract_wrappers.dutch_auction.DutchAuction(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for DutchAuction Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[DutchAuctionValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

get_auction_details = None

Constructor-initialized instance of GetAuctionDetailsMethod.

match_orders = None

Constructor-initialized instance of MatchOrdersMethod.

class zero_ex.contract_wrappers.dutch_auction.DutchAuctionValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.dutch_auction.GetAuctionDetailsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getAuctionDetails method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(order, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(order, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calculates the Auction Details for the given order

Parameters
  • order (Tuple0x260219a2) – The sell order

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple0xdc58a88c

Returns

the return value of the underlying method.

estimate_gas(order, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(order, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Calculates the Auction Details for the given order

Parameters
  • order (Tuple0x260219a2) – The sell order

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(order)[source]

Validate the inputs to the getAuctionDetails method.

class zero_ex.contract_wrappers.dutch_auction.MatchOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the matchOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(buy_order, sell_order, buy_signature, sell_signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(buy_order, sell_order, buy_signature, sell_signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Matches the buy and sell orders at an amount given the following: the current block time, the auction start time and the auction begin amount. The sell order is a an order at the lowest amount at the end of the auction. Excess from the match is transferred to the seller. Over time the price moves from beginAmount to endAmount given the current block.timestamp. sellOrder.expiryTimeSeconds is the end time of the auction. sellOrder.takerAssetAmount is the end amount of the auction (lowest possible amount). sellOrder.makerAssetData is the ABI encoded Asset Proxy data with the following data appended buyOrder.makerAssetData is the buyers bid on the auction, must meet the amount for the current block timestamp (uint256 beginTimeSeconds, uint256 beginAmount). This function reverts in the following scenarios: * Auction has not started (auctionDetails.currentTimeSeconds < auctionDetails.beginTimeSeconds) * Auction has expired (auctionDetails.endTimeSeconds < auctionDetails.currentTimeSeconds) * Amount is invalid: Buy order amount is too low (buyOrder.makerAssetAmount < auctionDetails.currentAmount) * Amount is invalid: Invalid begin amount (auctionDetails.beginAmount > auctionDetails.endAmount) * Any failure in the 0x Match Orders

Parameters
  • buyOrder – The Buyer’s order. This order is for the current expected price of the auction.

  • buySignature – Proof that order was created by the buyer.

  • sellOrder – The Seller’s order. This order is for the lowest amount (at the end of the auction).

  • sellSignature – Proof that order was created by the seller.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple0x054ca44e

Returns

the return value of the underlying method.

estimate_gas(buy_order, sell_order, buy_signature, sell_signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(buy_order, sell_order, buy_signature, sell_signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Matches the buy and sell orders at an amount given the following: the current block time, the auction start time and the auction begin amount. The sell order is a an order at the lowest amount at the end of the auction. Excess from the match is transferred to the seller. Over time the price moves from beginAmount to endAmount given the current block.timestamp. sellOrder.expiryTimeSeconds is the end time of the auction. sellOrder.takerAssetAmount is the end amount of the auction (lowest possible amount). sellOrder.makerAssetData is the ABI encoded Asset Proxy data with the following data appended buyOrder.makerAssetData is the buyers bid on the auction, must meet the amount for the current block timestamp (uint256 beginTimeSeconds, uint256 beginAmount). This function reverts in the following scenarios: * Auction has not started (auctionDetails.currentTimeSeconds < auctionDetails.beginTimeSeconds) * Auction has expired (auctionDetails.endTimeSeconds < auctionDetails.currentTimeSeconds) * Amount is invalid: Buy order amount is too low (buyOrder.makerAssetAmount < auctionDetails.currentAmount) * Amount is invalid: Invalid begin amount (auctionDetails.beginAmount > auctionDetails.endAmount) * Any failure in the 0x Match Orders

Parameters
  • buyOrder – The Buyer’s order. This order is for the current expected price of the auction.

  • buySignature – Proof that order was created by the buyer.

  • sellOrder – The Seller’s order. This order is for the lowest amount (at the end of the auction).

  • sellSignature – Proof that order was created by the seller.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(buy_order, sell_order, buy_signature, sell_signature)[source]

Validate the inputs to the matchOrders method.

zero_ex.contract_wrappers.erc1155_mintable

Generated wrapper for ERC1155Mintable Solidity contract.

class zero_ex.contract_wrappers.erc1155_mintable.BalanceOfBatchMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOfBatch method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owners, ids, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters
  • ids (List[int]) – ID of the Tokens

  • owners (List[str]) – The addresses of the token holders

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[int]

Returns

The _owner’s balance of the Token types requested

estimate_gas(owners, ids, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owners, ids)[source]

Validate the inputs to the balanceOfBatch method.

class zero_ex.contract_wrappers.erc1155_mintable.BalanceOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner, _id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters
  • id – ID of the Token

  • owner (str) – The address of the token holder

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

The _owner’s balance of the Token type requested

estimate_gas(owner, _id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner, _id)[source]

Validate the inputs to the balanceOf method.

class zero_ex.contract_wrappers.erc1155_mintable.CreateMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the create method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(uri, is_nf, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(uri, is_nf, tx_params=None)[source]

Execute underlying contract method via eth_call.

creates a new token

Parameters
  • isNF – is non-fungible token

  • uri (str) – URI of token

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

the return value of the underlying method.

estimate_gas(uri, is_nf, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(uri, is_nf, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

creates a new token

Parameters
  • isNF – is non-fungible token

  • uri (str) – URI of token

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(uri, is_nf)[source]

Validate the inputs to the create method.

class zero_ex.contract_wrappers.erc1155_mintable.CreateWithTypeMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the createWithType method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_type, uri, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_type, uri, tx_params=None)[source]

Execute underlying contract method via eth_call.

creates a new token

Parameters
  • type – of token

  • uri (str) – URI of token

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_type, uri, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_type, uri, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

creates a new token

Parameters
  • type – of token

  • uri (str) – URI of token

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_type, uri)[source]

Validate the inputs to the createWithType method.

class zero_ex.contract_wrappers.erc1155_mintable.CreatorsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the creators method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the creators method.

class zero_ex.contract_wrappers.erc1155_mintable.ERC1155Mintable(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC1155Mintable Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC1155MintableValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

balance_of = None

Constructor-initialized instance of BalanceOfMethod.

balance_of_batch = None

Constructor-initialized instance of BalanceOfBatchMethod.

create = None

Constructor-initialized instance of CreateMethod.

create_with_type = None

Constructor-initialized instance of CreateWithTypeMethod.

creators = None

Constructor-initialized instance of CreatorsMethod.

erc1155_batch_received = None

Constructor-initialized instance of Erc1155BatchReceivedMethod.

erc1155_received = None

Constructor-initialized instance of Erc1155ReceivedMethod.

get_approval_for_all_event(tx_hash)[source]

Get log entry for ApprovalForAll event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ApprovalForAll event

Return type

Tuple[AttributeDict]

get_non_fungible_base_type = None

Constructor-initialized instance of GetNonFungibleBaseTypeMethod.

get_non_fungible_index = None

Constructor-initialized instance of GetNonFungibleIndexMethod.

get_transfer_batch_event(tx_hash)[source]

Get log entry for TransferBatch event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting TransferBatch event

Return type

Tuple[AttributeDict]

get_transfer_single_event(tx_hash)[source]

Get log entry for TransferSingle event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting TransferSingle event

Return type

Tuple[AttributeDict]

get_uri_event(tx_hash)[source]

Get log entry for URI event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting URI event

Return type

Tuple[AttributeDict]

is_approved_for_all = None

Constructor-initialized instance of IsApprovedForAllMethod.

is_fungible = None

Constructor-initialized instance of IsFungibleMethod.

is_non_fungible = None

Constructor-initialized instance of IsNonFungibleMethod.

is_non_fungible_base_type = None

Constructor-initialized instance of IsNonFungibleBaseTypeMethod.

is_non_fungible_item = None

Constructor-initialized instance of IsNonFungibleItemMethod.

max_index = None

Constructor-initialized instance of MaxIndexMethod.

mint_fungible = None

Constructor-initialized instance of MintFungibleMethod.

mint_non_fungible = None

Constructor-initialized instance of MintNonFungibleMethod.

owner_of = None

Constructor-initialized instance of OwnerOfMethod.

safe_batch_transfer_from = None

Constructor-initialized instance of SafeBatchTransferFromMethod.

safe_transfer_from = None

Constructor-initialized instance of SafeTransferFromMethod.

set_approval_for_all = None

Constructor-initialized instance of SetApprovalForAllMethod.

class zero_ex.contract_wrappers.erc1155_mintable.ERC1155MintableValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc1155_mintable.Erc1155BatchReceivedMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the ERC1155_BATCH_RECEIVED method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc1155_mintable.Erc1155ReceivedMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the ERC1155_RECEIVED method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc1155_mintable.GetNonFungibleBaseTypeMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getNonFungibleBaseType method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns base type of non-fungible token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the getNonFungibleBaseType method.

class zero_ex.contract_wrappers.erc1155_mintable.GetNonFungibleIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getNonFungibleIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns index of non-fungible token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the getNonFungibleIndex method.

class zero_ex.contract_wrappers.erc1155_mintable.IsApprovedForAllMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isApprovedForAll method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(owner, operator, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters
  • operator (str) – Address of authorized operator

  • owner (str) – The owner of the Tokens

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

True if the operator is approved, false if not

estimate_gas(owner, operator, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(owner, operator)[source]

Validate the inputs to the isApprovedForAll method.

class zero_ex.contract_wrappers.erc1155_mintable.IsFungibleMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isFungible method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns true if token is fungible

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the isFungible method.

class zero_ex.contract_wrappers.erc1155_mintable.IsNonFungibleBaseTypeMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isNonFungibleBaseType method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns true if input is base-type of a non-fungible token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the isNonFungibleBaseType method.

class zero_ex.contract_wrappers.erc1155_mintable.IsNonFungibleItemMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isNonFungibleItem method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns true if input is a non-fungible token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the isNonFungibleItem method.

class zero_ex.contract_wrappers.erc1155_mintable.IsNonFungibleMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isNonFungible method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Returns true if token is non-fungible

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the isNonFungible method.

class zero_ex.contract_wrappers.erc1155_mintable.MaxIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the maxIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the maxIndex method.

class zero_ex.contract_wrappers.erc1155_mintable.MintFungibleMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the mintFungible method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_id, to, quantities, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_id, to, quantities, tx_params=None)[source]

Execute underlying contract method via eth_call.

mints fungible tokens

Parameters
  • id – token type

  • quantities (List[int]) – amounts of minted tokens

  • to (List[str]) – beneficiaries of minted tokens

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_id, to, quantities, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_id, to, quantities, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

mints fungible tokens

Parameters
  • id – token type

  • quantities (List[int]) – amounts of minted tokens

  • to (List[str]) – beneficiaries of minted tokens

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_id, to, quantities)[source]

Validate the inputs to the mintFungible method.

class zero_ex.contract_wrappers.erc1155_mintable.MintNonFungibleMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the mintNonFungible method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_type, to, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_type, to, tx_params=None)[source]

Execute underlying contract method via eth_call.

mints a non-fungible token

Parameters
  • to (List[str]) – beneficiaries of minted tokens

  • type – token type

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_type, to, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_type, to, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

mints a non-fungible token

Parameters
  • to (List[str]) – beneficiaries of minted tokens

  • type – token type

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_type, to)[source]

Validate the inputs to the mintNonFungible method.

class zero_ex.contract_wrappers.erc1155_mintable.OwnerOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the ownerOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

returns owner of a non-fungible token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_id)[source]

Validate the inputs to the ownerOf method.

class zero_ex.contract_wrappers.erc1155_mintable.SafeBatchTransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the safeBatchTransferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, to, ids, values, data, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, to, ids, values, data, tx_params=None)[source]

Execute underlying contract method via eth_call.

MUST emit TransferBatch event on success. Caller must be approved to manage the _from account’s tokens (see isApprovedForAll). MUST throw if _to is the zero address. MUST throw if length of _ids is not the same as length of _values. MUST throw if any of the balance of sender for token _ids is lower than the respective _values sent. MUST throw on any other error. When transfer is complete, this function MUST check if _to is a smart contract (code size > 0). If so, it MUST call onERC1155BatchReceived on _to and revert if the return value is not bytes4(keccak256(“onERC1155BatchReceived(address,address,uint256[],ui- nt256[],bytes)”)).

Parameters
  • data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • from – Source addresses

  • ids (List[int]) – IDs of each token type

  • to (str) – Target addresses

  • values (List[int]) – Transfer amounts per token type

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_from, to, ids, values, data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, to, ids, values, data, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

MUST emit TransferBatch event on success. Caller must be approved to manage the _from account’s tokens (see isApprovedForAll). MUST throw if _to is the zero address. MUST throw if length of _ids is not the same as length of _values. MUST throw if any of the balance of sender for token _ids is lower than the respective _values sent. MUST throw on any other error. When transfer is complete, this function MUST check if _to is a smart contract (code size > 0). If so, it MUST call onERC1155BatchReceived on _to and revert if the return value is not bytes4(keccak256(“onERC1155BatchReceived(address,address,uint256[],ui- nt256[],bytes)”)).

Parameters
  • data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • from – Source addresses

  • ids (List[int]) – IDs of each token type

  • to (str) – Target addresses

  • values (List[int]) – Transfer amounts per token type

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, to, ids, values, data)[source]

Validate the inputs to the safeBatchTransferFrom method.

class zero_ex.contract_wrappers.erc1155_mintable.SafeTransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the safeTransferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, to, _id, value, data, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, to, _id, value, data, tx_params=None)[source]

Execute underlying contract method via eth_call.

MUST emit TransferSingle event on success. Caller must be approved to manage the _from account’s tokens (see isApprovedForAll). MUST throw if _to is the zero address. MUST throw if balance of sender for token _id is lower than the _value sent. MUST throw on any other error. When transfer is complete, this function MUST check if _to is a smart contract (code size > 0). If so, it MUST call onERC1155Received on _to and revert if the return value is not bytes4(keccak256(“onERC11- 55Received(address,address,uint256,uint256,bytes)”)).

Parameters
  • data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • from – Source address

  • id – ID of the token type

  • to (str) – Target address

  • value (int) – Transfer amount

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_from, to, _id, value, data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, to, _id, value, data, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

MUST emit TransferSingle event on success. Caller must be approved to manage the _from account’s tokens (see isApprovedForAll). MUST throw if _to is the zero address. MUST throw if balance of sender for token _id is lower than the _value sent. MUST throw on any other error. When transfer is complete, this function MUST check if _to is a smart contract (code size > 0). If so, it MUST call onERC1155Received on _to and revert if the return value is not bytes4(keccak256(“onERC11- 55Received(address,address,uint256,uint256,bytes)”)).

Parameters
  • data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • from – Source address

  • id – ID of the token type

  • to (str) – Target address

  • value (int) – Transfer amount

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, to, _id, value, data)[source]

Validate the inputs to the safeTransferFrom method.

class zero_ex.contract_wrappers.erc1155_mintable.SetApprovalForAllMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setApprovalForAll method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(operator, approved, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(operator, approved, tx_params=None)[source]

Execute underlying contract method via eth_call.

MUST emit the ApprovalForAll event on success.

Parameters
  • approved (bool) – True if the operator is approved, false to revoke approval

  • operator (str) – Address to add to the set of authorized operators

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(operator, approved, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(operator, approved, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

MUST emit the ApprovalForAll event on success.

Parameters
  • approved (bool) – True if the operator is approved, false to revoke approval

  • operator (str) – Address to add to the set of authorized operators

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(operator, approved)[source]

Validate the inputs to the setApprovalForAll method.

zero_ex.contract_wrappers.erc1155_proxy

Generated wrapper for ERC1155Proxy Solidity contract.

class zero_ex.contract_wrappers.erc1155_proxy.AddAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the addAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the addAuthorizedAddress method.

class zero_ex.contract_wrappers.erc1155_proxy.AuthoritiesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorities method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorities method.

class zero_ex.contract_wrappers.erc1155_proxy.AuthorizedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorized method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorized method.

class zero_ex.contract_wrappers.erc1155_proxy.ERC1155Proxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC1155Proxy Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC1155ProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

add_authorized_address = None

Constructor-initialized instance of AddAuthorizedAddressMethod.

authorities = None

Constructor-initialized instance of AuthoritiesMethod.

authorized = None

Constructor-initialized instance of AuthorizedMethod.

get_authorized_address_added_event(tx_hash)[source]

Get log entry for AuthorizedAddressAdded event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressAdded event

Return type

Tuple[AttributeDict]

get_authorized_address_removed_event(tx_hash)[source]

Get log entry for AuthorizedAddressRemoved event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressRemoved event

Return type

Tuple[AttributeDict]

get_authorized_addresses = None

Constructor-initialized instance of GetAuthorizedAddressesMethod.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

remove_authorized_address = None

Constructor-initialized instance of RemoveAuthorizedAddressMethod.

remove_authorized_address_at_index = None

Constructor-initialized instance of RemoveAuthorizedAddressAtIndexMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

class zero_ex.contract_wrappers.erc1155_proxy.ERC1155ProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc1155_proxy.GetAuthorizedAddressesMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getAuthorizedAddresses method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets all authorized addresses.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

Array of authorized addresses.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc1155_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc1155_proxy.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc1155_proxy.RemoveAuthorizedAddressAtIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddressAtIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, index, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, index, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, index, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, index, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target, index)[source]

Validate the inputs to the removeAuthorizedAddressAtIndex method.

class zero_ex.contract_wrappers.erc1155_proxy.RemoveAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the removeAuthorizedAddress method.

class zero_ex.contract_wrappers.erc1155_proxy.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_data, _from, to, amount, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_data, _from, to, amount, tx_params=None)[source]

Execute underlying contract method via eth_call.

Transfers batch of ERC1155 assets. Either succeeds or throws.

Parameters
  • amount (int) – Amount that will be multiplied with each element of assetData.values to scale the values that will be transferred.

  • assetData – Byte array encoded with ERC1155 token address, array of ids, array of values, and callback data.

  • from – Address to transfer assets from.

  • to (str) – Address to transfer assets to.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_data, _from, to, amount, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_data, _from, to, amount, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Transfers batch of ERC1155 assets. Either succeeds or throws.

Parameters
  • amount (int) – Amount that will be multiplied with each element of assetData.values to scale the values that will be transferred.

  • assetData – Byte array encoded with ERC1155 token address, array of ids, array of values, and callback data.

  • from – Address to transfer assets from.

  • to (str) – Address to transfer assets to.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_data, _from, to, amount)[source]

Validate the inputs to the transferFrom method.

class zero_ex.contract_wrappers.erc1155_proxy.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

zero_ex.contract_wrappers.erc20_proxy

Generated wrapper for ERC20Proxy Solidity contract.

class zero_ex.contract_wrappers.erc20_proxy.AddAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the addAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the addAuthorizedAddress method.

class zero_ex.contract_wrappers.erc20_proxy.AuthoritiesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorities method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorities method.

class zero_ex.contract_wrappers.erc20_proxy.AuthorizedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorized method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorized method.

class zero_ex.contract_wrappers.erc20_proxy.ERC20Proxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC20Proxy Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC20ProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

add_authorized_address = None

Constructor-initialized instance of AddAuthorizedAddressMethod.

authorities = None

Constructor-initialized instance of AuthoritiesMethod.

authorized = None

Constructor-initialized instance of AuthorizedMethod.

get_authorized_address_added_event(tx_hash)[source]

Get log entry for AuthorizedAddressAdded event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressAdded event

Return type

Tuple[AttributeDict]

get_authorized_address_removed_event(tx_hash)[source]

Get log entry for AuthorizedAddressRemoved event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressRemoved event

Return type

Tuple[AttributeDict]

get_authorized_addresses = None

Constructor-initialized instance of GetAuthorizedAddressesMethod.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

remove_authorized_address = None

Constructor-initialized instance of RemoveAuthorizedAddressMethod.

remove_authorized_address_at_index = None

Constructor-initialized instance of RemoveAuthorizedAddressAtIndexMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

class zero_ex.contract_wrappers.erc20_proxy.ERC20ProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc20_proxy.GetAuthorizedAddressesMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getAuthorizedAddresses method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets all authorized addresses.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

Array of authorized addresses.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc20_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc20_proxy.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc20_proxy.RemoveAuthorizedAddressAtIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddressAtIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, index, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, index, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, index, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, index, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target, index)[source]

Validate the inputs to the removeAuthorizedAddressAtIndex method.

class zero_ex.contract_wrappers.erc20_proxy.RemoveAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the removeAuthorizedAddress method.

class zero_ex.contract_wrappers.erc20_proxy.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

zero_ex.contract_wrappers.erc20_token

Generated wrapper for ERC20Token Solidity contract.

class zero_ex.contract_wrappers.erc20_token.AllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the allowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, _spender, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters
  • _owner (str) – The address of the account owning tokens

  • _spender (str) – The address of the account able to transfer the tokens

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Amount of remaining tokens allowed to spent

estimate_gas(_owner, _spender, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner, _spender)[source]

Validate the inputs to the allowance method.

class zero_ex.contract_wrappers.erc20_token.ApproveMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the approve method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_spender, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_spender, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

msg.sender approves _spender to spend _value tokens

Parameters
  • _spender (str) – The address of the account able to transfer the tokens

  • _value (int) – The amount of wei to be approved for transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_spender, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_spender, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

msg.sender approves _spender to spend _value tokens

Parameters
  • _spender (str) – The address of the account able to transfer the tokens

  • _value (int) – The amount of wei to be approved for transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_spender, _value)[source]

Validate the inputs to the approve method.

class zero_ex.contract_wrappers.erc20_token.BalanceOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Query the balance of owner

Parameters
  • _owner (str) – The address from which the balance will be retrieved

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Balance of owner

estimate_gas(_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner)[source]

Validate the inputs to the balanceOf method.

class zero_ex.contract_wrappers.erc20_token.ERC20Token(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC20Token Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC20TokenValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

allowance = None

Constructor-initialized instance of AllowanceMethod.

approve = None

Constructor-initialized instance of ApproveMethod.

balance_of = None

Constructor-initialized instance of BalanceOfMethod.

get_approval_event(tx_hash)[source]

Get log entry for Approval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Approval event

Return type

Tuple[AttributeDict]

get_transfer_event(tx_hash)[source]

Get log entry for Transfer event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Transfer event

Return type

Tuple[AttributeDict]

total_supply = None

Constructor-initialized instance of TotalSupplyMethod.

transfer = None

Constructor-initialized instance of TransferMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

class zero_ex.contract_wrappers.erc20_token.ERC20TokenValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc20_token.TotalSupplyMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the totalSupply method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Query total supply of token

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

Total supply of token

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc20_token.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, _to, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, _to, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

send value token to to from from on the condition it is approved by from

Parameters
  • _from (str) – The address of the sender

  • _to (str) – The address of the recipient

  • _value (int) – The amount of token to be transferred

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_from, _to, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, _to, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

send value token to to from from on the condition it is approved by from

Parameters
  • _from (str) – The address of the sender

  • _to (str) – The address of the recipient

  • _value (int) – The amount of token to be transferred

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, _to, _value)[source]

Validate the inputs to the transferFrom method.

class zero_ex.contract_wrappers.erc20_token.TransferMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transfer method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_to, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_to, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

send value token to to from msg.sender

Parameters
  • _to (str) – The address of the recipient

  • _value (int) – The amount of token to be transferred

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_to, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_to, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

send value token to to from msg.sender

Parameters
  • _to (str) – The address of the recipient

  • _value (int) – The amount of token to be transferred

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_to, _value)[source]

Validate the inputs to the transfer method.

zero_ex.contract_wrappers.erc721_proxy

Generated wrapper for ERC721Proxy Solidity contract.

class zero_ex.contract_wrappers.erc721_proxy.AddAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the addAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the addAuthorizedAddress method.

class zero_ex.contract_wrappers.erc721_proxy.AuthoritiesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorities method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorities method.

class zero_ex.contract_wrappers.erc721_proxy.AuthorizedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorized method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorized method.

class zero_ex.contract_wrappers.erc721_proxy.ERC721Proxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC721Proxy Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC721ProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

add_authorized_address = None

Constructor-initialized instance of AddAuthorizedAddressMethod.

authorities = None

Constructor-initialized instance of AuthoritiesMethod.

authorized = None

Constructor-initialized instance of AuthorizedMethod.

get_authorized_address_added_event(tx_hash)[source]

Get log entry for AuthorizedAddressAdded event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressAdded event

Return type

Tuple[AttributeDict]

get_authorized_address_removed_event(tx_hash)[source]

Get log entry for AuthorizedAddressRemoved event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressRemoved event

Return type

Tuple[AttributeDict]

get_authorized_addresses = None

Constructor-initialized instance of GetAuthorizedAddressesMethod.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

remove_authorized_address = None

Constructor-initialized instance of RemoveAuthorizedAddressMethod.

remove_authorized_address_at_index = None

Constructor-initialized instance of RemoveAuthorizedAddressAtIndexMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

class zero_ex.contract_wrappers.erc721_proxy.ERC721ProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc721_proxy.GetAuthorizedAddressesMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getAuthorizedAddresses method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets all authorized addresses.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

Array of authorized addresses.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc721_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc721_proxy.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.erc721_proxy.RemoveAuthorizedAddressAtIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddressAtIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, index, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, index, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, index, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, index, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target, index)[source]

Validate the inputs to the removeAuthorizedAddressAtIndex method.

class zero_ex.contract_wrappers.erc721_proxy.RemoveAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the removeAuthorizedAddress method.

class zero_ex.contract_wrappers.erc721_proxy.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

zero_ex.contract_wrappers.erc721_token

Generated wrapper for ERC721Token Solidity contract.

class zero_ex.contract_wrappers.erc721_token.ApproveMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the approve method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_approved, _token_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_approved, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

The zero address indicates there is no approved address. Throws unless msg.sender is the current NFT owner, or an authorized operator of the current owner.

Parameters
  • _approved (str) – The new approved NFT controller

  • _tokenId – The NFT to approve

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_approved, _token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_approved, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

The zero address indicates there is no approved address. Throws unless msg.sender is the current NFT owner, or an authorized operator of the current owner.

Parameters
  • _approved (str) – The new approved NFT controller

  • _tokenId – The NFT to approve

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_approved, _token_id)[source]

Validate the inputs to the approve method.

class zero_ex.contract_wrappers.erc721_token.BalanceOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

NFTs assigned to the zero address are considered invalid, and this function throws for queries about the zero address.

Parameters
  • _owner (str) – An address for whom to query the balance

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

int

Returns

The number of NFTs owned by _owner, possibly zero

estimate_gas(_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner)[source]

Validate the inputs to the balanceOf method.

class zero_ex.contract_wrappers.erc721_token.ERC721Token(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ERC721Token Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ERC721TokenValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

approve = None

Constructor-initialized instance of ApproveMethod.

balance_of = None

Constructor-initialized instance of BalanceOfMethod.

get_approval_event(tx_hash)[source]

Get log entry for Approval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Approval event

Return type

Tuple[AttributeDict]

get_approval_for_all_event(tx_hash)[source]

Get log entry for ApprovalForAll event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ApprovalForAll event

Return type

Tuple[AttributeDict]

get_approved = None

Constructor-initialized instance of GetApprovedMethod.

get_transfer_event(tx_hash)[source]

Get log entry for Transfer event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Transfer event

Return type

Tuple[AttributeDict]

is_approved_for_all = None

Constructor-initialized instance of IsApprovedForAllMethod.

owner_of = None

Constructor-initialized instance of OwnerOfMethod.

safe_transfer_from1 = None

Constructor-initialized instance of SafeTransferFrom1Method.

safe_transfer_from2 = None

Constructor-initialized instance of SafeTransferFrom2Method.

set_approval_for_all = None

Constructor-initialized instance of SetApprovalForAllMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

class zero_ex.contract_wrappers.erc721_token.ERC721TokenValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.erc721_token.GetApprovedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getApproved method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Throws if _tokenId is not a valid NFT.

Parameters
  • _tokenId – The NFT to find the approved address for

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

The approved address for this NFT, or the zero address if there is none

estimate_gas(_token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_token_id)[source]

Validate the inputs to the getApproved method.

class zero_ex.contract_wrappers.erc721_token.IsApprovedForAllMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isApprovedForAll method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, _operator, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters
  • _operator (str) – The address that acts on behalf of the owner

  • _owner (str) – The address that owns the NFTs

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

True if _operator is an approved operator for _owner, false otherwise

estimate_gas(_owner, _operator, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner, _operator)[source]

Validate the inputs to the isApprovedForAll method.

class zero_ex.contract_wrappers.erc721_token.OwnerOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the ownerOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

NFTs assigned to zero address are considered invalid, and queries about them do throw.

Parameters
  • _tokenId – The identifier for an NFT

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

The address of the owner of the NFT

estimate_gas(_token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_token_id)[source]

Validate the inputs to the ownerOf method.

class zero_ex.contract_wrappers.erc721_token.SafeTransferFrom1Method(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the safeTransferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, _to, _token_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, _to, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

This works identically to the other function with an extra data parameter, except this function just sets data to “”.

Parameters
  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_from, _to, _token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, _to, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

This works identically to the other function with an extra data parameter, except this function just sets data to “”.

Parameters
  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, _to, _token_id)[source]

Validate the inputs to the safeTransferFrom method.

class zero_ex.contract_wrappers.erc721_token.SafeTransferFrom2Method(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the safeTransferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, _to, _token_id, _data, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, _to, _token_id, _data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Throws unless msg.sender is the current owner, an authorized operator, or the approved address for this NFT. Throws if _from is not the current owner. Throws if _to is the zero address. Throws if _tokenId is not a valid NFT. When transfer is complete, this function checks if _to is a smart contract (code size > 0). If so, it calls onERC721Received on _to and throws if the return value is not bytes4(keccak256(“onERC721Received(address,address,uint256,bytes)”)).

Parameters
  • _data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_from, _to, _token_id, _data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, _to, _token_id, _data, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Throws unless msg.sender is the current owner, an authorized operator, or the approved address for this NFT. Throws if _from is not the current owner. Throws if _to is the zero address. Throws if _tokenId is not a valid NFT. When transfer is complete, this function checks if _to is a smart contract (code size > 0). If so, it calls onERC721Received on _to and throws if the return value is not bytes4(keccak256(“onERC721Received(address,address,uint256,bytes)”)).

Parameters
  • _data (Union[bytes, str]) – Additional data with no specified format, sent in call to _to

  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, _to, _token_id, _data)[source]

Validate the inputs to the safeTransferFrom method.

class zero_ex.contract_wrappers.erc721_token.SetApprovalForAllMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setApprovalForAll method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_operator, _approved, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_operator, _approved, tx_params=None)[source]

Execute underlying contract method via eth_call.

Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner.

Parameters
  • _approved (bool) – True if the operator is approved, false to revoke approval

  • _operator (str) – Address to add to the set of authorized operators

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_operator, _approved, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_operator, _approved, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner.

Parameters
  • _approved (bool) – True if the operator is approved, false to revoke approval

  • _operator (str) – Address to add to the set of authorized operators

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_operator, _approved)[source]

Validate the inputs to the setApprovalForAll method.

class zero_ex.contract_wrappers.erc721_token.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, _to, _token_id, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, _to, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Throws unless msg.sender is the current owner, an authorized operator, or the approved address for this NFT. Throws if _from is not the current owner. Throws if _to is the zero address. Throws if _tokenId is not a valid NFT.

Parameters
  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_from, _to, _token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, _to, _token_id, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Throws unless msg.sender is the current owner, an authorized operator, or the approved address for this NFT. Throws if _from is not the current owner. Throws if _to is the zero address. Throws if _tokenId is not a valid NFT.

Parameters
  • _from (str) – The current owner of the NFT

  • _to (str) – The new owner

  • _tokenId – The NFT to transfer

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, _to, _token_id)[source]

Validate the inputs to the transferFrom method.

zero_ex.contract_wrappers.exchange

Generated wrapper for Exchange Solidity contract.

class zero_ex.contract_wrappers.exchange.AllowedValidatorsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the allowedValidators method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the allowedValidators method.

class zero_ex.contract_wrappers.exchange.BatchCancelOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchCancelOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of cancelOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(orders, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of cancelOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders)[source]

Validate the inputs to the batchCancelOrders method.

class zero_ex.contract_wrappers.exchange.BatchExecuteTransactionsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchExecuteTransactions method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transactions, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transactions, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes a batch of Exchange method calls in the context of signer(s).

Parameters
  • signatures (List[Union[bytes, str]]) – Array of proofs that transactions have been signed by signer(s).

  • transactions (List[LibZeroExTransactionZeroExTransaction]) – Array of 0x transaction structures.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[Union[bytes, str]]

Returns

the return value of the underlying method.

estimate_gas(transactions, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transactions, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes a batch of Exchange method calls in the context of signer(s).

Parameters
  • signatures (List[Union[bytes, str]]) – Array of proofs that transactions have been signed by signer(s).

  • transactions (List[LibZeroExTransactionZeroExTransaction]) – Array of 0x transaction structures.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transactions, signatures)[source]

Validate the inputs to the batchExecuteTransactions method.

class zero_ex.contract_wrappers.exchange.BatchFillOrKillOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchFillOrKillOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of fillOrKillOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[LibFillResultsFillResults]

Returns

the return value of the underlying method.

estimate_gas(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of fillOrKillOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_asset_fill_amounts, signatures)[source]

Validate the inputs to the batchFillOrKillOrders method.

class zero_ex.contract_wrappers.exchange.BatchFillOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchFillOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of fillOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[LibFillResultsFillResults]

Returns

the return value of the underlying method.

estimate_gas(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of fillOrder.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_asset_fill_amounts, signatures)[source]

Validate the inputs to the batchFillOrders method.

class zero_ex.contract_wrappers.exchange.BatchFillOrdersNoThrowMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchFillOrdersNoThrow method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of fillOrder. If any fill reverts, the error is caught and ignored.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

List[LibFillResultsFillResults]

Returns

the return value of the underlying method.

estimate_gas(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_asset_fill_amounts, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of fillOrder. If any fill reverts, the error is caught and ignored.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • takerAssetFillAmounts – Array of desired amounts of takerAsset to sell in orders.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_asset_fill_amounts, signatures)[source]

Validate the inputs to the batchFillOrdersNoThrow method.

class zero_ex.contract_wrappers.exchange.BatchMatchOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchMatchOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Match complementary orders that have a profitable spread. Each order is filled at their respective price point, and the matcher receives a profit denominated in the left maker asset.

Parameters
  • leftOrders – Set of orders with the same maker / taker asset.

  • leftSignatures – Proof that left orders were created by the left makers.

  • rightOrders – Set of orders to match against leftOrders

  • rightSignatures – Proof that right orders were created by the right makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsBatchMatchedFillResults

Returns

the return value of the underlying method.

estimate_gas(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Match complementary orders that have a profitable spread. Each order is filled at their respective price point, and the matcher receives a profit denominated in the left maker asset.

Parameters
  • leftOrders – Set of orders with the same maker / taker asset.

  • leftSignatures – Proof that left orders were created by the left makers.

  • rightOrders – Set of orders to match against leftOrders

  • rightSignatures – Proof that right orders were created by the right makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(left_orders, right_orders, left_signatures, right_signatures)[source]

Validate the inputs to the batchMatchOrders method.

class zero_ex.contract_wrappers.exchange.BatchMatchOrdersWithMaximalFillMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the batchMatchOrdersWithMaximalFill method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Match complementary orders that have a profitable spread. Each order is maximally filled at their respective price point, and the matcher receives a profit denominated in either the left maker asset, right maker asset, or a combination of both.

Parameters
  • leftOrders – Set of orders with the same maker / taker asset.

  • leftSignatures – Proof that left orders were created by the left makers.

  • rightOrders – Set of orders to match against leftOrders

  • rightSignatures – Proof that right orders were created by the right makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsBatchMatchedFillResults

Returns

the return value of the underlying method.

estimate_gas(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(left_orders, right_orders, left_signatures, right_signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Match complementary orders that have a profitable spread. Each order is maximally filled at their respective price point, and the matcher receives a profit denominated in either the left maker asset, right maker asset, or a combination of both.

Parameters
  • leftOrders – Set of orders with the same maker / taker asset.

  • leftSignatures – Proof that left orders were created by the left makers.

  • rightOrders – Set of orders to match against leftOrders

  • rightSignatures – Proof that right orders were created by the right makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(left_orders, right_orders, left_signatures, right_signatures)[source]

Validate the inputs to the batchMatchOrdersWithMaximalFill method.

class zero_ex.contract_wrappers.exchange.CancelOrderMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the cancelOrder method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(order, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(order, tx_params=None)[source]

Execute underlying contract method via eth_call.

After calling, the order can not be filled anymore.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(order, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(order, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

After calling, the order can not be filled anymore.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(order)[source]

Validate the inputs to the cancelOrder method.

class zero_ex.contract_wrappers.exchange.CancelOrdersUpToMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the cancelOrdersUpTo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target_order_epoch, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target_order_epoch, tx_params=None)[source]

Execute underlying contract method via eth_call.

Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).

Parameters
  • targetOrderEpoch – Orders created with a salt less or equal to this value will be cancelled.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target_order_epoch, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target_order_epoch, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).

Parameters
  • targetOrderEpoch – Orders created with a salt less or equal to this value will be cancelled.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target_order_epoch)[source]

Validate the inputs to the cancelOrdersUpTo method.

class zero_ex.contract_wrappers.exchange.CancelledMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the cancelled method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the cancelled method.

class zero_ex.contract_wrappers.exchange.CurrentContextAddressMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the currentContextAddress method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.Eip1271MagicValueMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP1271_MAGIC_VALUE method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.Eip712ExchangeDomainHashMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the EIP712_EXCHANGE_DOMAIN_HASH method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.Exchange(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for Exchange Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ExchangeValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

allowed_validators = None

Constructor-initialized instance of AllowedValidatorsMethod.

batch_cancel_orders = None

Constructor-initialized instance of BatchCancelOrdersMethod.

batch_execute_transactions = None

Constructor-initialized instance of BatchExecuteTransactionsMethod.

batch_fill_or_kill_orders = None

Constructor-initialized instance of BatchFillOrKillOrdersMethod.

batch_fill_orders = None

Constructor-initialized instance of BatchFillOrdersMethod.

batch_fill_orders_no_throw = None

Constructor-initialized instance of BatchFillOrdersNoThrowMethod.

batch_match_orders = None

Constructor-initialized instance of BatchMatchOrdersMethod.

batch_match_orders_with_maximal_fill = None

Constructor-initialized instance of BatchMatchOrdersWithMaximalFillMethod.

cancel_order = None

Constructor-initialized instance of CancelOrderMethod.

cancel_orders_up_to = None

Constructor-initialized instance of CancelOrdersUpToMethod.

cancelled = None

Constructor-initialized instance of CancelledMethod.

current_context_address = None

Constructor-initialized instance of CurrentContextAddressMethod.

eip1271_magic_value = None

Constructor-initialized instance of Eip1271MagicValueMethod.

eip712_exchange_domain_hash = None

Constructor-initialized instance of Eip712ExchangeDomainHashMethod.

execute_transaction = None

Constructor-initialized instance of ExecuteTransactionMethod.

fill_or_kill_order = None

Constructor-initialized instance of FillOrKillOrderMethod.

fill_order = None

Constructor-initialized instance of FillOrderMethod.

filled = None

Constructor-initialized instance of FilledMethod.

get_asset_proxy = None

Constructor-initialized instance of GetAssetProxyMethod.

get_asset_proxy_registered_event(tx_hash)[source]

Get log entry for AssetProxyRegistered event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AssetProxyRegistered event

Return type

Tuple[AttributeDict]

get_cancel_event(tx_hash)[source]

Get log entry for Cancel event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Cancel event

Return type

Tuple[AttributeDict]

get_cancel_up_to_event(tx_hash)[source]

Get log entry for CancelUpTo event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting CancelUpTo event

Return type

Tuple[AttributeDict]

get_fill_event(tx_hash)[source]

Get log entry for Fill event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Fill event

Return type

Tuple[AttributeDict]

get_order_info = None

Constructor-initialized instance of GetOrderInfoMethod.

get_protocol_fee_collector_address_event(tx_hash)[source]

Get log entry for ProtocolFeeCollectorAddress event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ProtocolFeeCollectorAddress event

Return type

Tuple[AttributeDict]

get_protocol_fee_multiplier_event(tx_hash)[source]

Get log entry for ProtocolFeeMultiplier event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting ProtocolFeeMultiplier event

Return type

Tuple[AttributeDict]

get_signature_validator_approval_event(tx_hash)[source]

Get log entry for SignatureValidatorApproval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting SignatureValidatorApproval event

Return type

Tuple[AttributeDict]

get_transaction_execution_event(tx_hash)[source]

Get log entry for TransactionExecution event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting TransactionExecution event

Return type

Tuple[AttributeDict]

is_valid_hash_signature = None

Constructor-initialized instance of IsValidHashSignatureMethod.

is_valid_order_signature = None

Constructor-initialized instance of IsValidOrderSignatureMethod.

is_valid_transaction_signature = None

Constructor-initialized instance of IsValidTransactionSignatureMethod.

market_buy_orders_fill_or_kill = None

Constructor-initialized instance of MarketBuyOrdersFillOrKillMethod.

market_buy_orders_no_throw = None

Constructor-initialized instance of MarketBuyOrdersNoThrowMethod.

market_sell_orders_fill_or_kill = None

Constructor-initialized instance of MarketSellOrdersFillOrKillMethod.

market_sell_orders_no_throw = None

Constructor-initialized instance of MarketSellOrdersNoThrowMethod.

match_orders = None

Constructor-initialized instance of MatchOrdersMethod.

match_orders_with_maximal_fill = None

Constructor-initialized instance of MatchOrdersWithMaximalFillMethod.

order_epoch = None

Constructor-initialized instance of OrderEpochMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

pre_sign = None

Constructor-initialized instance of PreSignMethod.

pre_signed = None

Constructor-initialized instance of PreSignedMethod.

protocol_fee_collector = None

Constructor-initialized instance of ProtocolFeeCollectorMethod.

protocol_fee_multiplier = None

Constructor-initialized instance of ProtocolFeeMultiplierMethod.

register_asset_proxy = None

Constructor-initialized instance of RegisterAssetProxyMethod.

set_protocol_fee_collector_address = None

Constructor-initialized instance of SetProtocolFeeCollectorAddressMethod.

set_protocol_fee_multiplier = None

Constructor-initialized instance of SetProtocolFeeMultiplierMethod.

set_signature_validator_approval = None

Constructor-initialized instance of SetSignatureValidatorApprovalMethod.

simulate_dispatch_transfer_from_calls = None

Constructor-initialized instance of SimulateDispatchTransferFromCallsMethod.

transactions_executed = None

Constructor-initialized instance of TransactionsExecutedMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

class zero_ex.contract_wrappers.exchange.ExchangeValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.exchange.ExecuteTransactionMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the executeTransaction method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(transaction, signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(transaction, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes an Exchange method call in the context of signer.

Parameters
  • signature (Union[bytes, str]) – Proof that transaction has been signed by signer.

  • transaction (LibZeroExTransactionZeroExTransaction) – 0x transaction structure.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

the return value of the underlying method.

estimate_gas(transaction, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(transaction, signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes an Exchange method call in the context of signer.

Parameters
  • signature (Union[bytes, str]) – Proof that transaction has been signed by signer.

  • transaction (LibZeroExTransactionZeroExTransaction) – 0x transaction structure.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(transaction, signature)[source]

Validate the inputs to the executeTransaction method.

class zero_ex.contract_wrappers.exchange.FillOrKillOrderMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the fillOrKillOrder method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Fills the input order. Reverts if exact takerAssetFillAmount not filled.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • signature (Union[bytes, str]) – Proof that order has been created by maker.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Fills the input order. Reverts if exact takerAssetFillAmount not filled.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • signature (Union[bytes, str]) – Proof that order has been created by maker.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(order, taker_asset_fill_amount, signature)[source]

Validate the inputs to the fillOrKillOrder method.

class zero_ex.contract_wrappers.exchange.FillOrderMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the fillOrder method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Fills the input order.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • signature (Union[bytes, str]) – Proof that order has been created by maker.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(order, taker_asset_fill_amount, signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Fills the input order.

Parameters
  • order (LibOrderOrder) – Order struct containing order specifications.

  • signature (Union[bytes, str]) – Proof that order has been created by maker.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(order, taker_asset_fill_amount, signature)[source]

Validate the inputs to the fillOrder method.

class zero_ex.contract_wrappers.exchange.FilledMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the filled method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the filled method.

class zero_ex.contract_wrappers.exchange.GetAssetProxyMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getAssetProxy method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_proxy_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets an asset proxy.

Parameters
  • assetProxyId – Id of the asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.

estimate_gas(asset_proxy_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_proxy_id)[source]

Validate the inputs to the getAssetProxy method.

class zero_ex.contract_wrappers.exchange.GetOrderInfoMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrderInfo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets information about an order: status, hash, and amount filled.

Parameters
  • order (LibOrderOrder) – Order to gather information on.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibOrderOrderInfo

Returns

OrderInfo Information about the order and its state. See LibOrder.OrderInfo for a complete description.

estimate_gas(order, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order)[source]

Validate the inputs to the getOrderInfo method.

class zero_ex.contract_wrappers.exchange.IsValidHashSignatureMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isValidHashSignature method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_hash, signer_address, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Verifies that a hash has been signed by the given signer.

Parameters
  • hash – Any 32-byte hash.

  • signature (Union[bytes, str]) – Proof that the hash has been signed by signer.

  • signerAddress – Address that should have signed the given hash.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

isValid true if the signature is valid for the given hash and signer.

estimate_gas(_hash, signer_address, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_hash, signer_address, signature)[source]

Validate the inputs to the isValidHashSignature method.

class zero_ex.contract_wrappers.exchange.IsValidOrderSignatureMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isValidOrderSignature method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Verifies that a signature for an order is valid.

Parameters
  • order (LibOrderOrder) – The order.

  • signature (Union[bytes, str]) – Proof that the order has been signed by signer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

isValid true if the signature is valid for the given order and signer.

estimate_gas(order, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order, signature)[source]

Validate the inputs to the isValidOrderSignature method.

class zero_ex.contract_wrappers.exchange.IsValidTransactionSignatureMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isValidTransactionSignature method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(transaction, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Verifies that a signature for a transaction is valid.

Parameters
  • signature (Union[bytes, str]) – Proof that the order has been signed by signer.

  • transaction (LibZeroExTransactionZeroExTransaction) – The transaction.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

isValid true if the signature is valid for the given transaction and signer.

estimate_gas(transaction, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(transaction, signature)[source]

Validate the inputs to the isValidTransactionSignature method.

class zero_ex.contract_wrappers.exchange.MarketBuyOrdersFillOrKillMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketBuyOrdersFillOrKill method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls marketBuyOrdersNoThrow then reverts if < makerAssetFillAmount has been bought. NOTE: This function does not enforce that the makerAsset is the same for each order.

Parameters
  • makerAssetFillAmount – Minimum amount of makerAsset to buy.

  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Calls marketBuyOrdersNoThrow then reverts if < makerAssetFillAmount has been bought. NOTE: This function does not enforce that the makerAsset is the same for each order.

Parameters
  • makerAssetFillAmount – Minimum amount of makerAsset to buy.

  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, maker_asset_fill_amount, signatures)[source]

Validate the inputs to the marketBuyOrdersFillOrKill method.

class zero_ex.contract_wrappers.exchange.MarketBuyOrdersNoThrowMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketBuyOrdersNoThrow method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. If any fill reverts, the error is caught and ignored. NOTE: This function does not enforce that the makerAsset is the same for each order.

Parameters
  • makerAssetFillAmount – Desired amount of makerAsset to buy.

  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, maker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. If any fill reverts, the error is caught and ignored. NOTE: This function does not enforce that the makerAsset is the same for each order.

Parameters
  • makerAssetFillAmount – Desired amount of makerAsset to buy.

  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, maker_asset_fill_amount, signatures)[source]

Validate the inputs to the marketBuyOrdersNoThrow method.

class zero_ex.contract_wrappers.exchange.MarketSellOrdersFillOrKillMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketSellOrdersFillOrKill method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Calls marketSellOrdersNoThrow then reverts if < takerAssetFillAmount has been sold. NOTE: This function does not enforce that the takerAsset is the same for each order.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • takerAssetFillAmount – Minimum amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Calls marketSellOrdersNoThrow then reverts if < takerAssetFillAmount has been sold. NOTE: This function does not enforce that the takerAsset is the same for each order.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • takerAssetFillAmount – Minimum amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_asset_fill_amount, signatures)[source]

Validate the inputs to the marketSellOrdersFillOrKill method.

class zero_ex.contract_wrappers.exchange.MarketSellOrdersNoThrowMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketSellOrdersNoThrow method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_call.

Executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. If any fill reverts, the error is caught and ignored. NOTE: This function does not enforce that the takerAsset is the same for each order.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsFillResults

Returns

the return value of the underlying method.

estimate_gas(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, taker_asset_fill_amount, signatures, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. If any fill reverts, the error is caught and ignored. NOTE: This function does not enforce that the takerAsset is the same for each order.

Parameters
  • orders (List[LibOrderOrder]) – Array of order specifications.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been signed by makers.

  • takerAssetFillAmount – Desired amount of takerAsset to sell.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, taker_asset_fill_amount, signatures)[source]

Validate the inputs to the marketSellOrdersNoThrow method.

class zero_ex.contract_wrappers.exchange.MatchOrdersMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the matchOrders method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Match two complementary orders that have a profitable spread. Each order is filled at their respective price point. However, the calculations are carried out as though the orders are both being filled at the right order’s price point. The profit made by the left order goes to the taker (who matched the two orders).

Parameters
  • leftOrder – First order to match.

  • leftSignature – Proof that order was created by the left maker.

  • rightOrder – Second order to match.

  • rightSignature – Proof that order was created by the right maker.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsMatchedFillResults

Returns

the return value of the underlying method.

estimate_gas(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Match two complementary orders that have a profitable spread. Each order is filled at their respective price point. However, the calculations are carried out as though the orders are both being filled at the right order’s price point. The profit made by the left order goes to the taker (who matched the two orders).

Parameters
  • leftOrder – First order to match.

  • leftSignature – Proof that order was created by the left maker.

  • rightOrder – Second order to match.

  • rightSignature – Proof that order was created by the right maker.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(left_order, right_order, left_signature, right_signature)[source]

Validate the inputs to the matchOrders method.

class zero_ex.contract_wrappers.exchange.MatchOrdersWithMaximalFillMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the matchOrdersWithMaximalFill method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Match two complementary orders that have a profitable spread. Each order is maximally filled at their respective price point, and the matcher receives a profit denominated in either the left maker asset, right maker asset, or a combination of both.

Parameters
  • leftOrder – First order to match.

  • leftSignature – Proof that order was created by the left maker.

  • rightOrder – Second order to match.

  • rightSignature – Proof that order was created by the right maker.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

LibFillResultsMatchedFillResults

Returns

the return value of the underlying method.

estimate_gas(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(left_order, right_order, left_signature, right_signature, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Match two complementary orders that have a profitable spread. Each order is maximally filled at their respective price point, and the matcher receives a profit denominated in either the left maker asset, right maker asset, or a combination of both.

Parameters
  • leftOrder – First order to match.

  • leftSignature – Proof that order was created by the left maker.

  • rightOrder – Second order to match.

  • rightSignature – Proof that order was created by the right maker.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(left_order, right_order, left_signature, right_signature)[source]

Validate the inputs to the matchOrdersWithMaximalFill method.

class zero_ex.contract_wrappers.exchange.OrderEpochMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the orderEpoch method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the orderEpoch method.

class zero_ex.contract_wrappers.exchange.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.PreSignMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the preSign method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_hash, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_hash, tx_params=None)[source]

Execute underlying contract method via eth_call.

Approves a hash on-chain. After presigning a hash, the preSign signature type will become valid for that hash and signer.

Parameters
  • hash – Any 32-byte hash.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(_hash, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_hash, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Approves a hash on-chain. After presigning a hash, the preSign signature type will become valid for that hash and signer.

Parameters
  • hash – Any 32-byte hash.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_hash)[source]

Validate the inputs to the preSign method.

class zero_ex.contract_wrappers.exchange.PreSignedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the preSigned method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the preSigned method.

class zero_ex.contract_wrappers.exchange.ProtocolFeeCollectorMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the protocolFeeCollector method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.ProtocolFeeMultiplierMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the protocolFeeMultiplier method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.exchange.RegisterAssetProxyMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the registerAssetProxy method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_proxy, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_proxy, tx_params=None)[source]

Execute underlying contract method via eth_call.

Registers an asset proxy to its asset proxy id. Once an asset proxy is registered, it cannot be unregistered.

Parameters
  • assetProxy – Address of new asset proxy to register.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_proxy, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_proxy, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Registers an asset proxy to its asset proxy id. Once an asset proxy is registered, it cannot be unregistered.

Parameters
  • assetProxy – Address of new asset proxy to register.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_proxy)[source]

Validate the inputs to the registerAssetProxy method.

class zero_ex.contract_wrappers.exchange.SetProtocolFeeCollectorAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setProtocolFeeCollectorAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(updated_protocol_fee_collector, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(updated_protocol_fee_collector, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows the owner to update the protocolFeeCollector address.

Parameters
  • updatedProtocolFeeCollector – The updated protocolFeeCollector contract address.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(updated_protocol_fee_collector, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(updated_protocol_fee_collector, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows the owner to update the protocolFeeCollector address.

Parameters
  • updatedProtocolFeeCollector – The updated protocolFeeCollector contract address.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(updated_protocol_fee_collector)[source]

Validate the inputs to the setProtocolFeeCollectorAddress method.

class zero_ex.contract_wrappers.exchange.SetProtocolFeeMultiplierMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setProtocolFeeMultiplier method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(updated_protocol_fee_multiplier, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(updated_protocol_fee_multiplier, tx_params=None)[source]

Execute underlying contract method via eth_call.

Allows the owner to update the protocol fee multiplier.

Parameters
  • updatedProtocolFeeMultiplier – The updated protocol fee multiplier.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(updated_protocol_fee_multiplier, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(updated_protocol_fee_multiplier, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Allows the owner to update the protocol fee multiplier.

Parameters
  • updatedProtocolFeeMultiplier – The updated protocol fee multiplier.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(updated_protocol_fee_multiplier)[source]

Validate the inputs to the setProtocolFeeMultiplier method.

class zero_ex.contract_wrappers.exchange.SetSignatureValidatorApprovalMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the setSignatureValidatorApproval method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(validator_address, approval, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(validator_address, approval, tx_params=None)[source]

Execute underlying contract method via eth_call.

Approves/unnapproves a Validator contract to verify signatures on signer’s behalf using the Validator signature type.

Parameters
  • approval (bool) – Approval or disapproval of Validator contract.

  • validatorAddress – Address of Validator contract.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(validator_address, approval, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(validator_address, approval, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Approves/unnapproves a Validator contract to verify signatures on signer’s behalf using the Validator signature type.

Parameters
  • approval (bool) – Approval or disapproval of Validator contract.

  • validatorAddress – Address of Validator contract.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(validator_address, approval)[source]

Validate the inputs to the setSignatureValidatorApproval method.

class zero_ex.contract_wrappers.exchange.SimulateDispatchTransferFromCallsMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the simulateDispatchTransferFromCalls method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_data, from_addresses, to_addresses, amounts, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_data, from_addresses, to_addresses, amounts, tx_params=None)[source]

Execute underlying contract method via eth_call.

This function may be used to simulate any amount of transfers As they would occur through the Exchange contract. Note that this function will always revert, even if all transfers are successful. However, it may be used with eth_call or with a try/catch pattern in order to simulate the results of the transfers.

Parameters
  • amounts (List[int]) – Array containing the amounts that correspond to each transfer.

  • assetData – Array of asset details, each encoded per the AssetProxy contract specification.

  • fromAddresses – Array containing the from addresses that correspond with each transfer.

  • toAddresses – Array containing the to addresses that correspond with each transfer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_data, from_addresses, to_addresses, amounts, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_data, from_addresses, to_addresses, amounts, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

This function may be used to simulate any amount of transfers As they would occur through the Exchange contract. Note that this function will always revert, even if all transfers are successful. However, it may be used with eth_call or with a try/catch pattern in order to simulate the results of the transfers.

Parameters
  • amounts (List[int]) – Array containing the amounts that correspond to each transfer.

  • assetData – Array of asset details, each encoded per the AssetProxy contract specification.

  • fromAddresses – Array containing the from addresses that correspond with each transfer.

  • toAddresses – Array containing the to addresses that correspond with each transfer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_data, from_addresses, to_addresses, amounts)[source]

Validate the inputs to the simulateDispatchTransferFromCalls method.

class zero_ex.contract_wrappers.exchange.TransactionsExecutedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transactionsExecuted method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the transactionsExecuted method.

class zero_ex.contract_wrappers.exchange.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

zero_ex.contract_wrappers.forwarder

Generated wrapper for Forwarder Solidity contract.

class zero_ex.contract_wrappers.forwarder.ApproveMakerAssetProxyMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the approveMakerAssetProxy method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_data, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract’s behalf. This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the Forwarder contract to the fee recipient. This method needs to be called before forwarding orders of a maker asset that hasn’t previously been approved.

Parameters
  • assetData – Byte array encoded for the respective asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_data, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract’s behalf. This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the Forwarder contract to the fee recipient. This method needs to be called before forwarding orders of a maker asset that hasn’t previously been approved.

Parameters
  • assetData – Byte array encoded for the respective asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_data)[source]

Validate the inputs to the approveMakerAssetProxy method.

class zero_ex.contract_wrappers.forwarder.Forwarder(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for Forwarder Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ForwarderValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

approve_maker_asset_proxy = None

Constructor-initialized instance of ApproveMakerAssetProxyMethod.

get_ownership_transferred_event(tx_hash)[source]

Get log entry for OwnershipTransferred event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting OwnershipTransferred event

Return type

Tuple[AttributeDict]

market_buy_orders_with_eth = None

Constructor-initialized instance of MarketBuyOrdersWithEthMethod.

market_sell_orders_with_eth = None

Constructor-initialized instance of MarketSellOrdersWithEthMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

withdraw_asset = None

Constructor-initialized instance of WithdrawAssetMethod.

class zero_ex.contract_wrappers.forwarder.ForwarderValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.forwarder.MarketBuyOrdersWithEthMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketBuyOrdersWithEth method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, maker_asset_buy_amount, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, maker_asset_buy_amount, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Execute underlying contract method via eth_call.

Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction. The Forwarder may fill more than makerAssetBuyAmount of the makerAsset so that it can pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees). Any ETH not spent will be refunded to sender.

Parameters
  • feePercentage – Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.

  • feeRecipient – Address that will receive ETH when orders are filled.

  • makerAssetBuyAmount – Desired amount of makerAsset to purchase.

  • orders (List[LibOrderOrder]) – Array of order specifications used containing desired makerAsset and WETH as takerAsset.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, int, int]

Returns

the return value of the underlying method.

estimate_gas(orders, maker_asset_buy_amount, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, maker_asset_buy_amount, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction. The Forwarder may fill more than makerAssetBuyAmount of the makerAsset so that it can pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees). Any ETH not spent will be refunded to sender.

Parameters
  • feePercentage – Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.

  • feeRecipient – Address that will receive ETH when orders are filled.

  • makerAssetBuyAmount – Desired amount of makerAsset to purchase.

  • orders (List[LibOrderOrder]) – Array of order specifications used containing desired makerAsset and WETH as takerAsset.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, maker_asset_buy_amount, signatures, fee_percentage, fee_recipient)[source]

Validate the inputs to the marketBuyOrdersWithEth method.

class zero_ex.contract_wrappers.forwarder.MarketSellOrdersWithEthMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the marketSellOrdersWithEth method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(orders, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(orders, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Execute underlying contract method via eth_call.

Purchases as much of orders’ makerAssets as possible by selling as much of the ETH value sent as possible, accounting for order and forwarder fees.

Parameters
  • feePercentage – Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.

  • feeRecipient – Address that will receive ETH when orders are filled.

  • orders (List[LibOrderOrder]) – Array of order specifications used containing desired makerAsset and WETH as takerAsset.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, int, int]

Returns

the return value of the underlying method.

estimate_gas(orders, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(orders, signatures, fee_percentage, fee_recipient, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Purchases as much of orders’ makerAssets as possible by selling as much of the ETH value sent as possible, accounting for order and forwarder fees.

Parameters
  • feePercentage – Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.

  • feeRecipient – Address that will receive ETH when orders are filled.

  • orders (List[LibOrderOrder]) – Array of order specifications used containing desired makerAsset and WETH as takerAsset.

  • signatures (List[Union[bytes, str]]) – Proofs that orders have been created by makers.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(orders, signatures, fee_percentage, fee_recipient)[source]

Validate the inputs to the marketSellOrdersWithEth method.

class zero_ex.contract_wrappers.forwarder.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.forwarder.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

class zero_ex.contract_wrappers.forwarder.WithdrawAssetMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the withdrawAsset method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_data, amount, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_data, amount, tx_params=None)[source]

Execute underlying contract method via eth_call.

Withdraws assets from this contract. It may be used by the owner to withdraw assets that were accidentally sent to this contract.

Parameters
  • amount (int) – Amount of the asset to withdraw.

  • assetData – Byte array encoded for the respective asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_data, amount, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_data, amount, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Withdraws assets from this contract. It may be used by the owner to withdraw assets that were accidentally sent to this contract.

Parameters
  • amount (int) – Amount of the asset to withdraw.

  • assetData – Byte array encoded for the respective asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_data, amount)[source]

Validate the inputs to the withdrawAsset method.

zero_ex.contract_wrappers.i_asset_proxy

Generated wrapper for IAssetProxy Solidity contract.

class zero_ex.contract_wrappers.i_asset_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.i_asset_proxy.IAssetProxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for IAssetProxy Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[IAssetProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

class zero_ex.contract_wrappers.i_asset_proxy.IAssetProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.i_asset_proxy.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_data, _from, to, amount, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_data, _from, to, amount, tx_params=None)[source]

Execute underlying contract method via eth_call.

Transfers assets. Either succeeds or throws.

Parameters
  • amount (int) – Amount of asset to transfer.

  • assetData – Byte array encoded for the respective asset proxy.

  • from – Address to transfer asset from.

  • to (str) – Address to transfer asset to.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_data, _from, to, amount, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_data, _from, to, amount, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Transfers assets. Either succeeds or throws.

Parameters
  • amount (int) – Amount of asset to transfer.

  • assetData – Byte array encoded for the respective asset proxy.

  • from – Address to transfer asset from.

  • to (str) – Address to transfer asset to.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_data, _from, to, amount)[source]

Validate the inputs to the transferFrom method.

zero_ex.contract_wrappers.i_validator

Generated wrapper for IValidator Solidity contract.

class zero_ex.contract_wrappers.i_validator.IValidator(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for IValidator Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[IValidatorValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

is_valid_signature = None

Constructor-initialized instance of IsValidSignatureMethod.

class zero_ex.contract_wrappers.i_validator.IValidatorValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.i_validator.IsValidSignatureMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isValidSignature method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_hash, signer_address, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Verifies that a signature is valid.

Parameters
  • hash – Message hash that is signed.

  • signature (Union[bytes, str]) – Proof of signing.

  • signerAddress – Address that should have signed the given hash.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Magic bytes4 value if the signature is valid. Magic value is bytes4(keccak256(“isValidValidatorSignature(address,bytes32,address,by- tes)”))

estimate_gas(_hash, signer_address, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_hash, signer_address, signature)[source]

Validate the inputs to the isValidSignature method.

zero_ex.contract_wrappers.i_wallet

Generated wrapper for IWallet Solidity contract.

class zero_ex.contract_wrappers.i_wallet.IWallet(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for IWallet Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[IWalletValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

is_valid_signature = None

Constructor-initialized instance of IsValidSignatureMethod.

class zero_ex.contract_wrappers.i_wallet.IWalletValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.i_wallet.IsValidSignatureMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the isValidSignature method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_hash, signature, tx_params=None)[source]

Execute underlying contract method via eth_call.

Validates a hash with the Wallet signature type.

Parameters
  • hash – Message hash that is signed.

  • signature (Union[bytes, str]) – Proof of signing.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

magicValue bytes4(0xb0671381) if the signature check succeeds.

estimate_gas(_hash, signature, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_hash, signature)[source]

Validate the inputs to the isValidSignature method.

zero_ex.contract_wrappers.multi_asset_proxy

Generated wrapper for MultiAssetProxy Solidity contract.

class zero_ex.contract_wrappers.multi_asset_proxy.AddAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the addAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Authorizes an address.

Parameters
  • target (str) – Address to authorize.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the addAuthorizedAddress method.

class zero_ex.contract_wrappers.multi_asset_proxy.AssetProxiesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the assetProxies method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the assetProxies method.

class zero_ex.contract_wrappers.multi_asset_proxy.AuthoritiesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorities method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorities method.

class zero_ex.contract_wrappers.multi_asset_proxy.AuthorizedMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the authorized method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the authorized method.

class zero_ex.contract_wrappers.multi_asset_proxy.GetAssetProxyMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getAssetProxy method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_proxy_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets an asset proxy.

Parameters
  • assetProxyId – Id of the asset proxy.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

str

Returns

The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.

estimate_gas(asset_proxy_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_proxy_id)[source]

Validate the inputs to the getAssetProxy method.

class zero_ex.contract_wrappers.multi_asset_proxy.GetAuthorizedAddressesMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getAuthorizedAddresses method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets all authorized addresses.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[str]

Returns

Array of authorized addresses.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.multi_asset_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.multi_asset_proxy.MultiAssetProxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for MultiAssetProxy Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[MultiAssetProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

add_authorized_address = None

Constructor-initialized instance of AddAuthorizedAddressMethod.

asset_proxies = None

Constructor-initialized instance of AssetProxiesMethod.

authorities = None

Constructor-initialized instance of AuthoritiesMethod.

authorized = None

Constructor-initialized instance of AuthorizedMethod.

get_asset_proxy = None

Constructor-initialized instance of GetAssetProxyMethod.

get_asset_proxy_registered_event(tx_hash)[source]

Get log entry for AssetProxyRegistered event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AssetProxyRegistered event

Return type

Tuple[AttributeDict]

get_authorized_address_added_event(tx_hash)[source]

Get log entry for AuthorizedAddressAdded event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressAdded event

Return type

Tuple[AttributeDict]

get_authorized_address_removed_event(tx_hash)[source]

Get log entry for AuthorizedAddressRemoved event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting AuthorizedAddressRemoved event

Return type

Tuple[AttributeDict]

get_authorized_addresses = None

Constructor-initialized instance of GetAuthorizedAddressesMethod.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

owner = None

Constructor-initialized instance of OwnerMethod.

register_asset_proxy = None

Constructor-initialized instance of RegisterAssetProxyMethod.

remove_authorized_address = None

Constructor-initialized instance of RemoveAuthorizedAddressMethod.

remove_authorized_address_at_index = None

Constructor-initialized instance of RemoveAuthorizedAddressAtIndexMethod.

transfer_ownership = None

Constructor-initialized instance of TransferOwnershipMethod.

class zero_ex.contract_wrappers.multi_asset_proxy.MultiAssetProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.multi_asset_proxy.OwnerMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the owner method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.multi_asset_proxy.RegisterAssetProxyMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the registerAssetProxy method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(asset_proxy, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(asset_proxy, tx_params=None)[source]

Execute underlying contract method via eth_call.

Registers an asset proxy to its asset proxy id. Once an asset proxy is registered, it cannot be unregistered.

Parameters
  • assetProxy – Address of new asset proxy to register.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(asset_proxy, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(asset_proxy, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Registers an asset proxy to its asset proxy id. Once an asset proxy is registered, it cannot be unregistered.

Parameters
  • assetProxy – Address of new asset proxy to register.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(asset_proxy)[source]

Validate the inputs to the registerAssetProxy method.

class zero_ex.contract_wrappers.multi_asset_proxy.RemoveAuthorizedAddressAtIndexMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddressAtIndex method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, index, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, index, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, index, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, index, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • index (int) – Index of target in authorities array.

  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target, index)[source]

Validate the inputs to the removeAuthorizedAddressAtIndex method.

class zero_ex.contract_wrappers.multi_asset_proxy.RemoveAuthorizedAddressMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the removeAuthorizedAddress method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(target, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(target, tx_params=None)[source]

Execute underlying contract method via eth_call.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(target, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(target, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Removes authorizion of an address.

Parameters
  • target (str) – Address to remove authorization from.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(target)[source]

Validate the inputs to the removeAuthorizedAddress method.

class zero_ex.contract_wrappers.multi_asset_proxy.TransferOwnershipMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferOwnership method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(new_owner, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(new_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(new_owner, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(new_owner)[source]

Validate the inputs to the transferOwnership method.

zero_ex.contract_wrappers.order_validator

Generated wrapper for OrderValidator Solidity contract.

class zero_ex.contract_wrappers.order_validator.GetBalanceAndAllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBalanceAndAllowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(target, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[int, int]

estimate_gas(target, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(target, asset_data)[source]

Validate the inputs to the getBalanceAndAllowance method.

class zero_ex.contract_wrappers.order_validator.GetBalancesAndAllowancesMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getBalancesAndAllowances method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(target, asset_data, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[List[int], List[int]]

estimate_gas(target, asset_data, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(target, asset_data)[source]

Validate the inputs to the getBalancesAndAllowances method.

class zero_ex.contract_wrappers.order_validator.GetErc721TokenOwnerMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getERC721TokenOwner method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(token, token_id, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(token, token_id, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(token, token_id)[source]

Validate the inputs to the getERC721TokenOwner method.

class zero_ex.contract_wrappers.order_validator.GetOrderAndTraderInfoMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrderAndTraderInfo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, taker_address, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[Tuple0xb1e4a1ae, Tuple0x8cfc0927]

estimate_gas(order, taker_address, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order, taker_address)[source]

Validate the inputs to the getOrderAndTraderInfo method.

class zero_ex.contract_wrappers.order_validator.GetOrdersAndTradersInfoMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getOrdersAndTradersInfo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(orders, taker_addresses, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple[List[Tuple0xb1e4a1ae], List[Tuple0x8cfc0927]]

estimate_gas(orders, taker_addresses, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(orders, taker_addresses)[source]

Validate the inputs to the getOrdersAndTradersInfo method.

class zero_ex.contract_wrappers.order_validator.GetTraderInfoMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTraderInfo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(order, taker_address, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Tuple0x8cfc0927

estimate_gas(order, taker_address, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(order, taker_address)[source]

Validate the inputs to the getTraderInfo method.

class zero_ex.contract_wrappers.order_validator.GetTradersInfoMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the getTradersInfo method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(orders, taker_addresses, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

List[Tuple0x8cfc0927]

estimate_gas(orders, taker_addresses, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(orders, taker_addresses)[source]

Validate the inputs to the getTradersInfo method.

class zero_ex.contract_wrappers.order_validator.OrderValidator(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for OrderValidator Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[OrderValidatorValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

get_balance_and_allowance = None

Constructor-initialized instance of GetBalanceAndAllowanceMethod.

get_balances_and_allowances = None

Constructor-initialized instance of GetBalancesAndAllowancesMethod.

get_erc721_token_owner = None

Constructor-initialized instance of GetErc721TokenOwnerMethod.

get_order_and_trader_info = None

Constructor-initialized instance of GetOrderAndTraderInfoMethod.

get_orders_and_traders_info = None

Constructor-initialized instance of GetOrdersAndTradersInfoMethod.

get_trader_info = None

Constructor-initialized instance of GetTraderInfoMethod.

get_traders_info = None

Constructor-initialized instance of GetTradersInfoMethod.

class zero_ex.contract_wrappers.order_validator.OrderValidatorValidator(web3_or_provider, contract_address)[source]

No-op input validator.

zero_ex.contract_wrappers.static_call_proxy

Generated wrapper for StaticCallProxy Solidity contract.

class zero_ex.contract_wrappers.static_call_proxy.GetProxyIdMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the getProxyId method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Gets the proxy id associated with the proxy address.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[bytes, str]

Returns

Proxy id.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.static_call_proxy.StaticCallProxy(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for StaticCallProxy Solidity contract.

All method parameters of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8").

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[StaticCallProxyValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

get_proxy_id = None

Constructor-initialized instance of GetProxyIdMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

class zero_ex.contract_wrappers.static_call_proxy.StaticCallProxyValidator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.static_call_proxy.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(asset_data, _from, to, amount, tx_params=None)[source]

Execute underlying contract method via eth_call.

Makes a staticcall to a target address and verifies that the data returned matches the expected return data.

Parameters
  • amount (int) – This value is ignored.

  • assetData – Byte array encoded with staticCallTarget, staticCallData, and expectedCallResultHash

  • from – This value is ignored.

  • to (str) – This value is ignored.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

None

estimate_gas(asset_data, _from, to, amount, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(asset_data, _from, to, amount)[source]

Validate the inputs to the transferFrom method.

zero_ex.contract_wrappers.weth9

Generated wrapper for WETH9 Solidity contract.

class zero_ex.contract_wrappers.weth9.AllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the allowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, index_1, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, index_1, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0, index_1)[source]

Validate the inputs to the allowance method.

class zero_ex.contract_wrappers.weth9.ApproveMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the approve method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(guy, wad, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(guy, wad, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(guy, wad, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(guy, wad, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(guy, wad)[source]

Validate the inputs to the approve method.

class zero_ex.contract_wrappers.weth9.BalanceOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(index_0, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(index_0, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(index_0)[source]

Validate the inputs to the balanceOf method.

class zero_ex.contract_wrappers.weth9.DecimalsMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the decimals method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.weth9.DepositMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the deposit method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

build_transaction(tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

class zero_ex.contract_wrappers.weth9.NameMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the name method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.weth9.SymbolMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the symbol method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.weth9.TotalSupplyMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the totalSupply method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.weth9.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(src, dst, wad, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(src, dst, wad, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(src, dst, wad, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(src, dst, wad, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(src, dst, wad)[source]

Validate the inputs to the transferFrom method.

class zero_ex.contract_wrappers.weth9.TransferMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transfer method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(dst, wad, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(dst, wad, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(dst, wad, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(dst, wad, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(dst, wad)[source]

Validate the inputs to the transfer method.

class zero_ex.contract_wrappers.weth9.WETH9(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for WETH9 Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[WETH9Validator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

allowance = None

Constructor-initialized instance of AllowanceMethod.

approve = None

Constructor-initialized instance of ApproveMethod.

balance_of = None

Constructor-initialized instance of BalanceOfMethod.

decimals = None

Constructor-initialized instance of DecimalsMethod.

deposit = None

Constructor-initialized instance of DepositMethod.

get_approval_event(tx_hash)[source]

Get log entry for Approval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Approval event

Return type

Tuple[AttributeDict]

get_deposit_event(tx_hash)[source]

Get log entry for Deposit event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Deposit event

Return type

Tuple[AttributeDict]

get_transfer_event(tx_hash)[source]

Get log entry for Transfer event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Transfer event

Return type

Tuple[AttributeDict]

get_withdrawal_event(tx_hash)[source]

Get log entry for Withdrawal event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Withdrawal event

Return type

Tuple[AttributeDict]

name = None

Constructor-initialized instance of NameMethod.

symbol = None

Constructor-initialized instance of SymbolMethod.

total_supply = None

Constructor-initialized instance of TotalSupplyMethod.

transfer = None

Constructor-initialized instance of TransferMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

withdraw = None

Constructor-initialized instance of WithdrawMethod.

class zero_ex.contract_wrappers.weth9.WETH9Validator(web3_or_provider, contract_address)[source]

No-op input validator.

class zero_ex.contract_wrappers.weth9.WithdrawMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the withdraw method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(wad, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(wad, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

None

Returns

the return value of the underlying method.

estimate_gas(wad, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(wad, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(wad)[source]

Validate the inputs to the withdraw method.

zero_ex.contract_wrappers.zrx_token

Generated wrapper for ZRXToken Solidity contract.

class zero_ex.contract_wrappers.zrx_token.AllowanceMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the allowance method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, _spender, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(_owner, _spender, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner, _spender)[source]

Validate the inputs to the allowance method.

class zero_ex.contract_wrappers.zrx_token.ApproveMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the approve method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_spender, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_spender, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_spender, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_spender, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_spender, _value)[source]

Validate the inputs to the approve method.

class zero_ex.contract_wrappers.zrx_token.BalanceOfMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the balanceOf method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

call(_owner, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(_owner, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

validate_and_normalize_inputs(_owner)[source]

Validate the inputs to the balanceOf method.

class zero_ex.contract_wrappers.zrx_token.DecimalsMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the decimals method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.zrx_token.NameMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the name method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.zrx_token.SymbolMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the symbol method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

str

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.zrx_token.TotalSupplyMethod(web3_or_provider, contract_address, contract_function)[source]

Various interfaces to the totalSupply method.

__init__(web3_or_provider, contract_address, contract_function)[source]

Persist instance data.

call(tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

int

estimate_gas(tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

class zero_ex.contract_wrappers.zrx_token.TransferFromMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transferFrom method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_from, _to, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_from, _to, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.

Parameters
  • _from (str) – Address to transfer from.

  • _to (str) – Address to transfer to.

  • _value (int) – Amount to transfer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_from, _to, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_from, _to, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.

Parameters
  • _from (str) – Address to transfer from.

  • _to (str) – Address to transfer to.

  • _value (int) – Amount to transfer.

  • tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_from, _to, _value)[source]

Validate the inputs to the transferFrom method.

class zero_ex.contract_wrappers.zrx_token.TransferMethod(web3_or_provider, contract_address, contract_function, validator=None)[source]

Various interfaces to the transfer method.

__init__(web3_or_provider, contract_address, contract_function, validator=None)[source]

Persist instance data.

build_transaction(_to, _value, tx_params=None)[source]

Construct calldata to be used as input to the method.

Return type

dict

call(_to, _value, tx_params=None)[source]

Execute underlying contract method via eth_call.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

bool

Returns

the return value of the underlying method.

estimate_gas(_to, _value, tx_params=None)[source]

Estimate gas consumption of method call.

Return type

int

send_transaction(_to, _value, tx_params=None)[source]

Execute underlying contract method via eth_sendTransaction.

Parameters

tx_params (Optional[TxParams]) – transaction parameters

Return type

Union[HexBytes, bytes]

validate_and_normalize_inputs(_to, _value)[source]

Validate the inputs to the transfer method.

class zero_ex.contract_wrappers.zrx_token.ZRXToken(web3_or_provider, contract_address, validator=None)[source]

Wrapper class for ZRXToken Solidity contract.

__init__(web3_or_provider, contract_address, validator=None)[source]

Get an instance of wrapper for smart contract.

Parameters
  • web3_or_provider (Union[Web3, BaseProvider]) – Either an instance of web3.Web3 or web3.providers.base.BaseProvider

  • contract_address (str) – where the contract has been deployed

  • validator (Optional[ZRXTokenValidator]) – for validation of method inputs.

__weakref__

list of weak references to the object (if defined)

static abi()[source]

Return the ABI to the underlying contract.

allowance = None

Constructor-initialized instance of AllowanceMethod.

approve = None

Constructor-initialized instance of ApproveMethod.

balance_of = None

Constructor-initialized instance of BalanceOfMethod.

decimals = None

Constructor-initialized instance of DecimalsMethod.

get_approval_event(tx_hash)[source]

Get log entry for Approval event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Approval event

Return type

Tuple[AttributeDict]

get_transfer_event(tx_hash)[source]

Get log entry for Transfer event.

Parameters

tx_hash (Union[HexBytes, bytes]) – hash of transaction emitting Transfer event

Return type

Tuple[AttributeDict]

name = None

Constructor-initialized instance of NameMethod.

symbol = None

Constructor-initialized instance of SymbolMethod.

total_supply = None

Constructor-initialized instance of TotalSupplyMethod.

transfer = None

Constructor-initialized instance of TransferMethod.

transfer_from = None

Constructor-initialized instance of TransferFromMethod.

class zero_ex.contract_wrappers.zrx_token.ZRXTokenValidator(web3_or_provider, contract_address)[source]

No-op input validator.

zero_ex.contract_wrappers.TxParams

class zero_ex.contract_wrappers.TxParams(*, from_=None, value=None, gas=None, gas_price=None, nonce=None)[source]

Transaction parameters for use with contract wrappers.

Parameters
  • from – default None, string of account address to initiate tx from

  • value – default None, integer of amount of ETH in Wei for transfer

  • gas – default None, integer maximum amount of ETH in Wei for gas

  • grasPrice – default None, integer price of unit of gas

  • nonce – default None, integer nonce for account

as_dict()[source]

Get transaction params as dict appropriate for web3.

zero_ex.contract_wrappers.exchange.types

Conveniences for handling types representing Exchange Solidity structs.

The TypedDict classes in the .exchange module represent tuples encountered in the Exchange contract’s ABI. However, they have weird names, containing hashes of the tuple’s field names, because the name of a Solidity struct isn’t conveyed through the ABI. This module provides type aliases with human-friendly names.

class zero_ex.contract_wrappers.exchange.types.Order

The Order Solidity struct.

Also known as zero_ex.contract_wrappers.exchange.LibOrderOrder.

class zero_ex.contract_wrappers.exchange.types.OrderInfo

The OrderInfo Solidity struct.

Also known as zero_ex.contract_wrappers.exchange.LibOrderOrderInfo.

class zero_ex.contract_wrappers.exchange.types.FillResults

The FillResults Solidity struct.

Also known as zero_ex.contract_wrappers.exchange.LibFillResultsFillResults.

class zero_ex.contract_wrappers.exchange.types.MatchedFillResults

The MatchedFillResults Solidity struct.

Also known as zero_ex.contract_wrappers.exchange.LibFillResultsMatchedFillResults.

class zero_ex.contract_wrappers.exchange.types.ZeroExTransaction

The ZeroExTransaction Solidity struct.

Also known as zero_ex.contract_wrappers.exchange.LibZeroExTransactionZeroExTransaction.

zero_ex.contract_wrappers.exchange: Generated Tuples

class zero_ex.contract_wrappers.exchange.LibOrderOrder

Python representation of a tuple or struct.

Solidity compiler output does not include the names of structs that appear in method definitions. A tuple found in an ABI may have been written in Solidity as a literal, anonymous tuple, or it may have been written as a named struct, but there is no way to tell from the compiler output. This class represents a tuple that appeared in a method definition. Its name is derived from a hash of that tuple’s field names, and every method whose ABI refers to a tuple with that same list of field names will have a generated wrapper method that refers to this class.

Any members of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8")

This is the generated class representing the Order struct.

class zero_ex.contract_wrappers.exchange.LibFillResultsFillResults

Python representation of a tuple or struct.

Solidity compiler output does not include the names of structs that appear in method definitions. A tuple found in an ABI may have been written in Solidity as a literal, anonymous tuple, or it may have been written as a named struct, but there is no way to tell from the compiler output. This class represents a tuple that appeared in a method definition. Its name is derived from a hash of that tuple’s field names, and every method whose ABI refers to a tuple with that same list of field names will have a generated wrapper method that refers to this class.

Any members of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8")

This is the generated class representing the FillResults struct.

class zero_ex.contract_wrappers.exchange.LibFillResultsMatchedFillResults

Python representation of a tuple or struct.

Solidity compiler output does not include the names of structs that appear in method definitions. A tuple found in an ABI may have been written in Solidity as a literal, anonymous tuple, or it may have been written as a named struct, but there is no way to tell from the compiler output. This class represents a tuple that appeared in a method definition. Its name is derived from a hash of that tuple’s field names, and every method whose ABI refers to a tuple with that same list of field names will have a generated wrapper method that refers to this class.

Any members of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8")

This is the generated class representing the MatchedFillResults struct.

class zero_ex.contract_wrappers.exchange.LibOrderOrderInfo

Python representation of a tuple or struct.

Solidity compiler output does not include the names of structs that appear in method definitions. A tuple found in an ABI may have been written in Solidity as a literal, anonymous tuple, or it may have been written as a named struct, but there is no way to tell from the compiler output. This class represents a tuple that appeared in a method definition. Its name is derived from a hash of that tuple’s field names, and every method whose ABI refers to a tuple with that same list of field names will have a generated wrapper method that refers to this class.

Any members of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8")

This is the generated class representing the OrderInfo struct.

class zero_ex.contract_wrappers.exchange.LibZeroExTransactionZeroExTransaction

Python representation of a tuple or struct.

Solidity compiler output does not include the names of structs that appear in method definitions. A tuple found in an ABI may have been written in Solidity as a literal, anonymous tuple, or it may have been written as a named struct, but there is no way to tell from the compiler output. This class represents a tuple that appeared in a method definition. Its name is derived from a hash of that tuple’s field names, and every method whose ABI refers to a tuple with that same list of field names will have a generated wrapper method that refers to this class.

Any members of type bytes should be encoded as UTF-8, which can be accomplished via str.encode("utf_8")

This is the generated class representing the ZeroExTransaction struct.

Indices and tables