Skip to content

Use NamedTuples properly (formerly task for startMultipleTokenOrders) #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LoznianuAnamaria opened this issue Jan 7, 2022 · 1 comment
Assignees
Milestone

Comments

@LoznianuAnamaria
Copy link
Contributor

LoznianuAnamaria commented Jan 7, 2022

Currently we have an issue with startMultipleTokenOrders function in ERC721Factory. The issue comes from the "tuple[]" encoding, which web3.py does not support correctly. This means we have to do manual encoding, and possibly send the transaction without web3.py.

We have the following options:

  • figure out a way to send the transaction with encoded parameters using web3.py, but skipping ContractFunction logic
  • if we are unable to do so, we must broadcast the transaction completely raw, using no tools/libraries, in which case we also have to handle the confirmation logic that the transaction took place (what web3.py handles out of the box)

What we have until now:

  • using a tuple instead of the previously-used dictionary
  • we are converting providerData to bytes (it is originally a string, but we can't send it like that)
  • encoding with the following signature
encd = encode_single("(address,address,uint256,address,address,uint256,uint8,bytes32,bytes32,bytes32)[]", [base_tuple])

specifically, see

transaction = {
        "from": eth_tester.get_accounts()[0],
        "to": contract_address,
        "gas": 500000,
        "data": encode_hex(fn_selector + encode_abi(arg_types, fn_args)),
    }
@LoznianuAnamaria LoznianuAnamaria added this to the V4 milestone Jan 11, 2022
@calina-c calina-c changed the title Handle startMultipleOrders function Use NamedTuples properly (formerly task for startMultipleTokenOrders) Jan 28, 2022
@calina-c
Copy link
Contributor

Merged in two fixes. The library now allows for uniform passing of tuples, dicts and our specific NamedTuples. However, we handle an extra conversion before sending it to web3.py, conversion which will happen on web3.py once ethereum/web3.py#2312 is merged in. Then we can erase the conversions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants