-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
dcc37b3
feat(ponder-ens): introduce plugin architecture
tk-o a5bfb00
feat(ponder-ens-plugin): update abis and contract configs
tk-o 2578b0f
fix(ens-base-plugin): enalbe domain insert setup event
tk-o fae9508
feat(ponder-ens-plugin): include early adopter registrar contract
tk-o e1dad39
feat(ponder-ens-plugin): focus plugins around domain names
tk-o 1931ec7
checkpoint: pull shared logic for registry and resolvers into shared …
shrugs 3d181f9
feat: refactor plugin logic, DRY handler code
shrugs 2d079a7
chore: inline some addreses
shrugs 32912d5
refactor: DRY up registrar code
shrugs 7f84cff
Merge pull request #4 from namehash/refactor/plugin-logic
shrugs a88933e
feat(ponder-ens-plugin): use domain name path as a namespace
tk-o 7e5af0e
chore(ponder-ens-plugin): use biomejs formatter
tk-o cd152a6
fix: tidy registrar handlers
shrugs dc0bfdd
fix: handle preminted domain in base node
shrugs 77c1ec2
fix(base.eth): handle `NameRegisteredWithRecord` event
tk-o ff0b2af
fix(deps): update ponder version
tk-o b3c17e5
fix: use selected root domain name
tk-o 0e35dd8
refactor: rename consts to apply feedback
tk-o e5d7541
docs(base.eth): update readme
tk-o 067f570
refactor(ponder-plugins): simplify architecture
tk-o e3b62c0
refactor(ponder-plugins): use `managed subname` term
tk-o aad651c
refactor(ponder-plugins): make generic handlers to use ponder types
tk-o 00c9935
chore(code-style): apply `biome format --fix`
tk-o a39200f
fix(ci): run static analysis
tk-o 9eb9eef
refactor(plugins): rename plugins directory
tk-o 728ec62
refactor(plugins): rename plugin helpers
tk-o 7c4bc1e
refactor(plugins): rename plugin helpers file
tk-o 9891ed0
refactor(plugins): rename ponder plugins to just plugins
tk-o 7b81161
refactor(plugins): drop the ACTIVE_PLUGIN env var parser
tk-o 1dbe2a9
refactor(plugins): use `ownedSubname` name
tk-o cc6f2c3
refactor(plugins): rename `ownedSubname` to `ownedName`
tk-o File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# RPC configuration | ||
# Follow the format: RPC_URL_{chainId}={rpcUrl} | ||
|
||
RPC_URL_1=https://ethereum-rpc.publicnode.com | ||
RPC_URL_8453=https://base-rpc.publicnode.com | ||
RPC_URL_59144=https://linea-rpc.publicnode.com | ||
|
||
# Identify which indexer plugin to activate (see `src/plugins` for available plugins) | ||
|
||
ACTIVE_PLUGIN=base.eth | ||
|
||
# Database configuration | ||
|
||
# This is where the indexer will create the tables defined in ponder.schema.ts | ||
# No two indexer instances can use the same database schema at the same time. This prevents data corruption. | ||
# @link https://ponder.sh/docs/api-reference/database#database-schema-rules | ||
DATABASE_SCHEMA=subname_index_base.eth | ||
# The indexer will use Postgres with that as the connection string. If not defined, the indexer will use PSlite. | ||
DATABASE_URL=postgresql://dbuser:abcd1234@localhost:5432/my_database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Static Analysis | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { ACTIVE_PLUGIN } from "./src/lib/plugin-helpers"; | ||
import { | ||
activate as activateEthBase, | ||
config as ethBaseConfig, | ||
ownedName as ethBaseOwnedName, | ||
} from "./src/plugins/base.eth/ponder.config"; | ||
import { | ||
activate as activateEth, | ||
config as ethConfig, | ||
ownedName as ethOwnedName, | ||
} from "./src/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 (ACTIVE_PLUGIN) { | ||
case ethOwnedName: | ||
activateEth(); | ||
return ethConfig as AllConfigs; | ||
case ethBaseOwnedName: | ||
activateEthBase(); | ||
return ethBaseConfig as AllConfigs; | ||
default: | ||
throw new Error(`Unsupported ACTIVE_PLUGIN: ${ACTIVE_PLUGIN}`); | ||
} | ||
})(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Great to see this!