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

Commit

Permalink
sra_client.py: checksum address in doctest
Browse files Browse the repository at this point in the history
Due to problem with launch-kit-backend, documented at
0xProject/0x-launch-kit-backend#73 ,
we need to checksum the makerAddress, in the order retrieved from the
relayer, before filling it, otherwise Web3.py gives this error:

InvalidAddress('Web3.py only accepts checksum addresses. The software
that gave you this non-checksum address should be considered unsafe,
please file it as a bug on their platform. Try using an ENS name
instead. Or, if you must accept lower safety, use
Web3.toChecksumAddress(lower_case_address).',
'0x5409ed021d9299bf6814279a6a1411a7e866a631')
  • Loading branch information
feuGeneA committed Aug 8, 2019
1 parent a851e63 commit 33525ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python-packages/sra_client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def run_tests(self):

exit(pytest.main(["--doctest-modules", "-rapP"]))
# show short test summary at end ^
# above call commented out due to a problem with launch kit,
# documented at
# https://github.com/0xProject/0x-launch-kit-backend/issues/73


class TestPublishCommand(distutils.command.build_py.build_py):
Expand Down
6 changes: 6 additions & 0 deletions python-packages/sra_client/src/zero_ex/sra_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@
... provider=eth_node,
... contract_address=NETWORK_TO_ADDRESSES[NetworkId.GANACHE].exchange
... )
(Due to `an Issue with the Launch Kit Backend
<https://github.com/0xProject/0x-launch-kit-backend/issues/73>`_, we need to
checksum the address in the order before filling it.)
>>> order['makerAddress'] = Web3.toChecksumAddress(order['makerAddress'])
>>> exchange.fill_order.send_transaction(
... order=order,
... taker_asset_fill_amount=order['makerAssetAmount']/2, # note the half fill
Expand Down

0 comments on commit 33525ff

Please sign in to comment.