Skip to content

How to call read-only function from other contract address inside the event handler? #179

Answered by 0xOlias
pyk asked this question in Question
Discussion options

You must be logged in to vote

Thanks for the question! A few points here:

  • At the moment, Ponder does not have a pattern for handling projects that use a factory pattern like UniV2. I'm actively thinking through how we should solve for this "dynamic data sources" requirement, which is very common. Ideas welcome!
  • The context.contracts object currently includes a ReadOnlyContract object for each contract defined in ponder.config.ts. This has proven convenient for a lot of projects, but it's not as powerful as just having the viem.PublicClient object for each network. There's nothing stopping us from including those. It could look like this:
ponder.on("ContractName:EventName", async ({ event, context }) => {
  const client

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pyk
Comment options

Answer selected by pyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants