-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(ponder-ens): introduce plugin architecture #3
Changes from 24 commits
dcc37b3
a5bfb00
2578b0f
fae9508
e1dad39
1931ec7
3d181f9
2d079a7
32912d5
7f84cff
a88933e
7e5af0e
cd152a6
dc0bfdd
77c1ec2
ff0b2af
b3c17e5
0e35dd8
e5d7541
067f570
e3b62c0
aad651c
00c9935
a39200f
9eb9eef
728ec62
7c4bc1e
9891ed0
7b81161
1dbe2a9
cc6f2c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# RPC urls, follow the format RPC_URL_{chainId}={rpcUrl} | ||
|
||
PONDER_RPC_URL_1=https://ethereum-rpc.publicnode.com | ||
PONDER_RPC_URL_8453=https://base-rpc.publicnode.com | ||
PONDER_RPC_URL_59144=https://linea-rpc.publicnode.com | ||
|
||
# ponder indexer ens deployment configuration | ||
|
||
INDEX_SUBNAME=base.eth | ||
|
||
# ponder indexer database configuration | ||
|
||
## one schema name per chain ID, i.e. ponder_ens_${INDEX_SUBNAME} | ||
DATABASE_SCHEMA=ponder_ens_base.eth | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please document more details about how this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tk-o This remains an open feedback item. I'm also concerned to read "chain id" here. I'm very worried we're getting key ideas confused. In my understanding, "chain id" should not be THE key consideration in our configurations. The For example, the chain to index is determined by the subnames to be indexed. Not the other way around. |
||
DATABASE_URL=postgresql://dbuser:abcd1234@localhost:5432/my_database |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Static Analysis | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great to see this! |
||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
biome-ci: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run Biome CI | ||
run: pnpm biome ci |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,98 +1,29 @@ | ||||||
import { createConfig, factory, mergeAbis } from "ponder"; | ||||||
import { http, getAbiItem } from "viem"; | ||||||
import { INDEXED_SUBNAME } from "./src/lib/ens-helpers"; | ||||||
import { | ||||||
activate as activateEthBase, | ||||||
config as ethBaseConfig, | ||||||
managedSubname as ethBaseManagedSubname, | ||||||
} from "./src/ponder-ens-plugins/eth.base/ponder.config"; | ||||||
import { | ||||||
activate as activateEth, | ||||||
config as ethConfig, | ||||||
managedSubname as ethManagedSubname, | ||||||
} from "./src/ponder-ens-plugins/eth/ponder.config"; | ||||||
|
||||||
import { BaseRegistrar } from "./abis/BaseRegistrar"; | ||||||
import { EthRegistrarController } from "./abis/EthRegistrarController"; | ||||||
import { EthRegistrarControllerOld } from "./abis/EthRegistrarControllerOld"; | ||||||
import { LegacyPublicResolver } from "./abis/LegacyPublicResolver"; | ||||||
import { NameWrapper } from "./abis/NameWrapper"; | ||||||
import { Registry } from "./abis/Registry"; | ||||||
import { Resolver } from "./abis/Resolver"; | ||||||
type AllConfigs = typeof ethConfig & typeof ethBaseConfig; | ||||||
|
||||||
// just for testing... | ||||||
const END_BLOCK = 12_000_000; | ||||||
|
||||||
const RESOLVER_ABI = mergeAbis([LegacyPublicResolver, Resolver]); | ||||||
|
||||||
const REGISTRY_OLD_ADDRESS = "0x314159265dd8dbb310642f98f50c066173c1259b"; | ||||||
const REGISTRY_ADDRESS = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; | ||||||
|
||||||
const BASE_REGISTRAR_ADDRESS = "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"; | ||||||
const ETH_REGISTRAR_CONTROLLER_OLD_ADDRESS = "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5"; | ||||||
const ETH_REGISTRAR_CONTROLLER_ADDRESS = "0x253553366Da8546fC250F225fe3d25d0C782303b"; | ||||||
const NAME_WRAPPER_ADDRESS = "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401"; | ||||||
|
||||||
export default createConfig({ | ||||||
networks: { | ||||||
mainnet: { | ||||||
chainId: 1, | ||||||
transport: http(process.env.PONDER_RPC_URL_1), | ||||||
}, | ||||||
}, | ||||||
contracts: { | ||||||
RegistryOld: { | ||||||
network: "mainnet", | ||||||
abi: Registry, | ||||||
address: REGISTRY_OLD_ADDRESS, | ||||||
startBlock: 3327417, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
Registry: { | ||||||
network: "mainnet", | ||||||
abi: Registry, | ||||||
address: REGISTRY_ADDRESS, | ||||||
startBlock: 9380380, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
OldRegistryResolvers: { | ||||||
network: "mainnet", | ||||||
abi: RESOLVER_ABI, | ||||||
address: factory({ | ||||||
address: REGISTRY_OLD_ADDRESS, | ||||||
event: getAbiItem({ abi: Registry, name: "NewResolver" }), | ||||||
parameter: "resolver", | ||||||
}), | ||||||
startBlock: 9380380, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
Resolver: { | ||||||
network: "mainnet", | ||||||
abi: RESOLVER_ABI, | ||||||
address: factory({ | ||||||
address: REGISTRY_ADDRESS, | ||||||
event: getAbiItem({ abi: Registry, name: "NewResolver" }), | ||||||
parameter: "resolver", | ||||||
}), | ||||||
startBlock: 9380380, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
BaseRegistrar: { | ||||||
network: "mainnet", | ||||||
abi: BaseRegistrar, | ||||||
address: BASE_REGISTRAR_ADDRESS, | ||||||
startBlock: 9380410, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
EthRegistrarControllerOld: { | ||||||
network: "mainnet", | ||||||
abi: EthRegistrarControllerOld, | ||||||
address: ETH_REGISTRAR_CONTROLLER_OLD_ADDRESS, | ||||||
startBlock: 9380471, | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
EthRegistrarController: { | ||||||
network: "mainnet", | ||||||
abi: EthRegistrarController, | ||||||
address: ETH_REGISTRAR_CONTROLLER_ADDRESS, | ||||||
startBlock: Math.min(16925618, END_BLOCK), | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
NameWrapper: { | ||||||
network: "mainnet", | ||||||
abi: NameWrapper, | ||||||
address: NAME_WRAPPER_ADDRESS, | ||||||
startBlock: Math.min(16925608, END_BLOCK), | ||||||
endBlock: END_BLOCK, | ||||||
}, | ||||||
}, | ||||||
}); | ||||||
// here we export only a single 'plugin's config, by type it as every config | ||||||
// this makes all of the mapping types happy at typecheck-time, but only the relevant | ||||||
// config is run at runtime | ||||||
export default ((): AllConfigs => { | ||||||
switch (INDEXED_SUBNAME) { | ||||||
case ethManagedSubname: | ||||||
activateEth(); | ||||||
return ethConfig as AllConfigs; | ||||||
case ethBaseManagedSubname: | ||||||
activateEthBase(); | ||||||
return ethBaseConfig as AllConfigs; | ||||||
default: | ||||||
throw new Error(`Unsupported base name: ${INDEXED_SUBNAME}`); | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add more docs here? For example? Does this value always need to be a single value, or can it be multiple values? If it can be multiple values, how to format it? It can also be nice to document which values are supported here or perhaps in the overall README.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tk-o This is still an open feedback