Hello Ethereum StackExchange community,

I'm currently working with the Multicall3 contract's tryAggregate3 function which returns an array of Result structs with the following format:

struct Result {
    bool success;
    bytes returnData;

When interacting with this contract using ethers.js, I can successfully decode the returned data like so:

coder = new ethers.utils.AbiCoder(); 
data = "<your_data_here>"; // replaced for brevity
decodedData = coder.decode(
    [ { type: "tuple[]", components: [
        { name: "success", type: "bool" },
        { name: "returnData", type: "bytes" }
    ] } ],

However, I am facing difficulties achieving the same result with web3.py. I have attempted to use the eth_abi library to decode the Result struct, but without success.

Can someone guide me on how to properly decode such structs with web3.py or provide a snippet of Python code that would mimic the above ethers.js functionality?

Any help would be greatly appreciated!

Thank you in advance!


Your Answer

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