ponder-sh / ponder

The backend framework for crypto apps
https://ponder.sh
MIT License
658 stars 105 forks source link

[Bug] Fix multicall on base #876

Open taarushv opened 6 months ago

taarushv commented 6 months ago

Not sure if there's a way to manually set the multicall contract for each network but it doesn't seem to work out of the box with base, forcing me to create/use a custom viem client. Replacing the client (to viem with base as the defined chain) below fixes my issue, despite using the same RPC on both runs

    const results = await client.multicall({
        contracts: [
          {
            ...ClubsV2Contract,
            functionName: "name",
            args: [event.args.id],
          },
          {
            ...ClubsV2Contract,
            functionName: "uris",
            args: [event.args.id],
          },
          {
            ...ClubsV2Contract,
            functionName: "coefficients",
            args: [event.args.id],
          }
        ],
      })

"@ponder/core": "^0.4.22"

typedarray commented 6 months ago

Got it. We're planning to make it possible to pass a viem Chain as an option to networks, which would solve this issue. Still working out the details of the API and migration path, cc @kyscott18.

In the meantime, you might be able to construct the multicall request using context.client.readContract, which means you'd still benefit from caching. The custom client approach will slow down reindexing significantly.