Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory contracts and sync engine upgrades #361

Merged
merged 64 commits into from
Oct 23, 2023

Conversation

typedarray
Copy link
Collaborator

@typedarray typedarray commented Sep 27, 2023

This PR introduces factory contract support and makes some improvements to the sync cache design.

WARNING

  • Existing Ponder apps that upgrade to this version will need to re-sync their event store from scratch. Large apps that have a long sync time should consider testing the re-sync on a new branch/railway project before upgrading on main.

How to test

  1. To create a new project on the prerelease version -> pnpm create ponder@next
  2. To upgrade an existing app -> pnpm upgrade @ponder/core@next (be warned, this will bust your local sync cache)
  3. Open up the new factory contracts documentation, and try to sync/index your favorite factory contract!

Fixes

@changeset-bot
Copy link

changeset-bot bot commented Sep 27, 2023

🦋 Changeset detected

Latest commit: 6f68c30

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@ponder/core Patch
ponder-examples-art-gobblers Patch
ponder-examples-ethfs Patch
ponder-examples-friendtech Patch
ponder-examples-token-erc20 Patch
ponder-examples-token-erc721 Patch
ponder-examples-token-reth Patch
ponder-examples-token-erc20-with-docker Patch
create-ponder Patch
eslint-config-ponder Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ponder-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 23, 2023 10:32pm

@typedarray typedarray changed the title [WIP] Sync cache upgrades + factory contracts [WIP] Factory contracts + cache upgrades Sep 28, 2023
@shrugs
Copy link
Contributor

shrugs commented Oct 20, 2023

bug report on 0.0.93-next.1: multiple factory configs using the same event but with different parameters doesn't seem to work in my case— only the first contract definition has its handlers invoked. the llama example works for me out of the box

const event = parseAbiItem("event NewNft(address pair, address nft)");

export const config: Config = {
  networks: [network],
  contracts: [
    {
      network: network.name,
      name: "LSSVMPair",
      abi: "./abis/LSSVMPair.json",
      startBlock: factoryConfig.startBlock,
      factory: {
        address: factoryConfig.address,
        event,
        parameter: "pair",
      },
    },
    {
      network: network.name,
      name: "NFT",
      abi: "./abis/NFT.json",
      startBlock: factoryConfig.startBlock,
      factory: {
        address: factoryConfig.address,
        event,
        parameter: "nft",
      },
    },
  ],
};

if i change the order of the contracts, it's always the first one that has its handlers invoked (i'm destroyng the ponder cache between runs)

Copy link
Collaborator Author

@typedarray typedarray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@typedarray typedarray merged commit 54bbd92 into main Oct 23, 2023
@typedarray typedarray deleted the typedarray/sync-cache-upgrades branch October 23, 2023 22:43
@github-actions github-actions bot mentioned this pull request Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants