2

How should I pass the following arguments to sendOFT function in This smart smart contract using python web3.py and block explorer? Here are the data types:

sendOFT arguments

FeeObj

I get an error when I pass elements like this. Here is a sample transaction and this is it's decoded input data:

sample tx

I would appreciate a complete input sample for both python web3.py(web3.js would be good as well) and Block Explorer.

1 Answer 1

1

In web3.py, you can pass a Solidity struct as

For example:


contract TupleContract {
    struct T { int x; bool[2] y; address[] z; }
    struct S { uint a; uint[] b; T[] c; }

    function method(S memory s) public pure returns (S memory) {
        return s;
    }
}

If you pass struct as a tuple, arguments must be in the same order as they are in Solidity source code.

You would encode this for a smart contract call as following


my_struct_t = (1, [False, False], ["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000"])

my_struct_s = (1, [1, 1], [my_struct_t, my_struct_t])

tuple_contract.functions.method(my_struct_s).transact({...})

See Web3.py documentation for more information.

As block explorers tend to be proprietary software, you need to contact the support desk of any block explorer to learn how to use their software, and this job should not be outsourced to the public community.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your time. But my problem wasn't just passing structs. There were some special attributes in arguments and I had a problem passing proper data types to them. I would appreciate it if you take a look at the photos I provided in my question.
Your question does not contain a repeatable code, but is bunch of links to hard to read pages. Please read how to ask a question page and edit your question to make it easier to understand and include necessary technical details and code. I cannot read your mind to underestand what you think is a special attribute

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.