banteg / multicall.py

aggregate results of multiple smart contract calls into one
MIT License
246 stars 106 forks source link

Functions returning only first return value #2

Closed kolyasapphire closed 2 years ago

kolyasapphire commented 3 years ago

Hi!

I was wondering if I'm missing something or functions are not returning all return values using Multicall([Call()]).

Example call:

Multicall(
            [
                Call(
                    address,
                    [
                        "my_function(uint256,uint256)(bytes,bytes,bytes)",
                        argument_1,
                        argument_2,
                    ],
                    [[i, None]],
                )
                for i in range(99)
            ]
)

I was able to fix this for my use case by changing decoded to [decoded] here:

https://github.com/banteg/multicall.py/blob/089b39067d8e8773706a01be3a774e24ab2f8dfb/multicall/call.py#L27

If it's indeed a bug, I would be happy to test my solution and submit a PR.

VensonLiou commented 2 years ago

Same issue here and solved with the solution by @kolyasapphire .

mihazelnik commented 2 years ago

@banteg what do you thing? I also have issues with not returning multiple values

BobTheBuidler commented 2 years ago

Using the current master branch, I don't have any issue returning multiple values. @MihaZelnik, if you upgrade the package, do you still have issues with this?

BobTheBuidler commented 2 years ago

In case anyone else has issues returning multiple values and stumbles across this thread... Make sure you encode the return values like so: yes - someFunction()((dtype,dtype)) no - someFunction()(dtype,dtype)

Closing this issue as the library is confirmed to work as intended.

mihazelnik commented 2 years ago

@BobTheBuidler perfect, thank you!