Skip to content

Use NamedTuples properly (formerly task for startMultipleTokenOrders) #639

@LoznianuAnamaria

Description

@LoznianuAnamaria

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)),
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions