alloy-rs / examples

Example code for using alloy and alloy-core
Apache License 2.0
136 stars 34 forks source link

feat/multicall_example #132

Open 0xMelkor opened 2 months ago

0xMelkor commented 2 months ago

Motivation

A Multicall3 example was missing, and so i added one.

Solution

Added an example under /contracts to fetch 10 UniswapV2 pool addresses with a single RPC call.

PR Checklist

zerosnacks commented 2 months ago

Hi @0xMelkor thanks for your PR!

There is currently an ongoing conversation about multicall / batched calls in Alloy and what the correct abstraction is. It is likely that the end user won't have to implement it themselves like this example shows.

One relevant PR is: https://github.com/alloy-rs/alloy/pull/1217

Will get back to you once there is more clarity on what direction we want to take.