banteg / multicall.py

aggregate results of multiple smart contract calls into one
MIT License
251 stars 108 forks source link

Add support for Multicall2 #8

Closed iliastsa closed 2 years ago

iliastsa commented 3 years ago

This PR adds support for makerdao's Multicall2 contract. This is useful in use cases where some call in the batch might fail, but we want the mutlicall to try and execute all included calls and not just fail.

In summary, Multicall can take an extra argument in it's constructor, specifying whether to use the new tryBlockAndAggregate contract method (require_success=False) or keep the old logic as-is. In the former case, return argument handlers receive two arguments:

  1. A boolean flag, indicating the return status of the call, and
  2. The return value if the call was successful, else None
DefiDebauchery commented 3 years ago

This would be incredibly helpful.

0xMarto commented 2 years ago

Great work! This PR really should be merged.

needalight commented 2 years ago

Definitely worth merging!