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

feat(ponder-ens): introduce plugin architecture #3

Merged
merged 31 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dcc37b3
feat(ponder-ens): introduce plugin architecture
tk-o Dec 31, 2024
a5bfb00
feat(ponder-ens-plugin): update abis and contract configs
tk-o Jan 3, 2025
2578b0f
fix(ens-base-plugin): enalbe domain insert setup event
tk-o Jan 3, 2025
fae9508
feat(ponder-ens-plugin): include early adopter registrar contract
tk-o Jan 3, 2025
e1dad39
feat(ponder-ens-plugin): focus plugins around domain names
tk-o Jan 3, 2025
1931ec7
checkpoint: pull shared logic for registry and resolvers into shared …
shrugs Jan 3, 2025
3d181f9
feat: refactor plugin logic, DRY handler code
shrugs Jan 3, 2025
2d079a7
chore: inline some addreses
shrugs Jan 3, 2025
32912d5
refactor: DRY up registrar code
shrugs Jan 3, 2025
7f84cff
Merge pull request #4 from namehash/refactor/plugin-logic
shrugs Jan 3, 2025
a88933e
feat(ponder-ens-plugin): use domain name path as a namespace
tk-o Jan 3, 2025
7e5af0e
chore(ponder-ens-plugin): use biomejs formatter
tk-o Jan 3, 2025
cd152a6
fix: tidy registrar handlers
shrugs Jan 3, 2025
dc0bfdd
fix: handle preminted domain in base node
shrugs Jan 4, 2025
77c1ec2
fix(base.eth): handle `NameRegisteredWithRecord` event
tk-o Jan 4, 2025
ff0b2af
fix(deps): update ponder version
tk-o Jan 5, 2025
b3c17e5
fix: use selected root domain name
tk-o Jan 5, 2025
0e35dd8
refactor: rename consts to apply feedback
tk-o Jan 6, 2025
e5d7541
docs(base.eth): update readme
tk-o Jan 6, 2025
067f570
refactor(ponder-plugins): simplify architecture
tk-o Jan 7, 2025
e3b62c0
refactor(ponder-plugins): use `managed subname` term
tk-o Jan 7, 2025
aad651c
refactor(ponder-plugins): make generic handlers to use ponder types
tk-o Jan 7, 2025
00c9935
chore(code-style): apply `biome format --fix`
tk-o Jan 8, 2025
a39200f
fix(ci): run static analysis
tk-o Jan 8, 2025
9eb9eef
refactor(plugins): rename plugins directory
tk-o Jan 8, 2025
728ec62
refactor(plugins): rename plugin helpers
tk-o Jan 8, 2025
7c4bc1e
refactor(plugins): rename plugin helpers file
tk-o Jan 8, 2025
9891ed0
refactor(plugins): rename ponder plugins to just plugins
tk-o Jan 8, 2025
7b81161
refactor(plugins): drop the ACTIVE_PLUGIN env var parser
tk-o Jan 8, 2025
1dbe2a9
refactor(plugins): use `ownedSubname` name
tk-o Jan 8, 2025
cc6f2c3
refactor(plugins): rename `ownedSubname` to `ownedName`
tk-o Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/handlers/Registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const makeRegistryHandlers = (root: Hex) => {
event,
}: {
context: Context;
event: Event<NsType<"BaseRegistrar:NameRegistered">>;
event: Omit<Event<NsType<"BaseRegistrar:NameRegistered">>, "name">;
}) {
const { id, owner, expires } = event.args;

Expand Down
9 changes: 6 additions & 3 deletions src/ponder-ens-plugins/eth.base/handlers/Registrar.ts
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about renaming the ponder-ens-plugins directory to just plugins? Seems more clean 😄

Assuming we do rename, please be sure to do it in the way that it's properly tracked by git as just renames, and not a bunch of file deletes / creations.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ponder } from "ponder:registry";
import { domains } from "ponder:schema";
import { domains, registrations } from "ponder:schema";
import { makeRegistryHandlers } from "../../../handlers/Registrar";
import { NAMEHASH_BASE_ETH, makeSubnodeNamehash, tokenIdToLabel } from "../../../lib/ens-helpers";
import { upsertAccount } from "../../../lib/upserts";
Expand All @@ -13,9 +13,12 @@ const {
handleNameTransferred,
} = makeRegistryHandlers(NAMEHASH_BASE_ETH);

// support NameRegisteredWithRecord

export default function () {
// support NameRegisteredWithRecord for BaseRegistrar as it used by Base's RegistrarControllers
ponder.on(ns("BaseRegistrar:NameRegisteredWithRecord"), async ({ context, event }) =>
handleNameRegistered({ context, event }),
);

ponder.on(ns("BaseRegistrar:NameRegistered"), async ({ context, event }) => {
// base has 'preminted' names via Registrar#registerOnly, which explicitly does not update Registry.
// this breaks a subgraph assumption, as it expects a domain to exist (via Registry:NewOwner) before
Expand Down
41 changes: 10 additions & 31 deletions src/ponder-ens-plugins/eth.base/ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ const rootDomain = "/eth/base" as const;
export const ns = createNs(rootDomain);
export type NsType<T extends string> = NsReturnType<T, typeof rootDomain>;

const REGISTRY_ADDRESS = "0xb94704422c2a1e396835a571837aa5ae53285a95";
const REGISTRY_START_BLOCK = 17571480;

const BASE_REGISTRAR_ADDRESS = "0x03c4738Ee98aE44591e1A4A4F3CaB6641d95DD9a";
const BASE_REGISTRAR_START_BLOCK = 17571486;

const REGISTRAR_CONTROLLER_ADDRESS = "0x4cCb0BB02FCABA27e82a56646E81d8c5bC4119a5";
const REGISTRAR_CONTROLLER_START_BLOCK = 18619035;

const EA_REGISTRAR_CONTROLLER_ADDRESS = "0xd3e6775ed9b7dc12b205c8e608dc3767b9e5efda";
const EA_REGISTRAR_CONTROLLER_START_BLOCK = 17575699;

const REVERSE_REGISTRAR_ADDRESS = "0x79ea96012eea67a83431f1701b3dff7e37f9e282";
const REVERSE_REGISTRAR_START_BLOCK = 17571485;

const L1_RESOLVER_ADDRESS = "0xde9049636F4a1dfE0a64d1bFe3155C0A14C54F31";
const L1_RESOLVER_START_BLOCK = 20420641;

const L2_RESOLVER_ADDRESS = "0xC6d566A56A1aFf6508b41f6c90ff131615583BCD";
const L2_RESOLVER_START_BLOCK = 17575714;

export const config = createConfig({
networks: {
base: {
Expand All @@ -45,36 +24,36 @@ export const config = createConfig({
[ns("Registry")]: {
network: "base",
abi: Registry,
address: REGISTRY_ADDRESS,
startBlock: REGISTRY_START_BLOCK,
address: "0xb94704422c2a1e396835a571837aa5ae53285a95",
startBlock: 17571480,
},
[ns("Resolver")]: {
network: "base",
abi: L2Resolver,
address: factory({
address: L2_RESOLVER_ADDRESS,
address: "0xb94704422c2a1e396835a571837aa5ae53285a95",
event: getAbiItem({ abi: Registry, name: "NewResolver" }),
parameter: "resolver",
}),
startBlock: L2_RESOLVER_START_BLOCK,
startBlock: 17575714,
},
[ns("BaseRegistrar")]: {
network: "base",
abi: BaseRegistrar,
address: BASE_REGISTRAR_ADDRESS,
startBlock: BASE_REGISTRAR_START_BLOCK,
address: "0x03c4738Ee98aE44591e1A4A4F3CaB6641d95DD9a",
startBlock: 17571486,
},
[ns("EARegistrarController")]: {
network: "base",
abi: EarlyAccessRegistrarController,
address: EA_REGISTRAR_CONTROLLER_ADDRESS,
startBlock: EA_REGISTRAR_CONTROLLER_START_BLOCK,
address: "0xd3e6775ed9b7dc12b205c8e608dc3767b9e5efda",
startBlock: 17575699,
},
[ns("RegistrarController")]: {
network: "base",
abi: RegistrarController,
address: REGISTRAR_CONTROLLER_ADDRESS,
startBlock: REGISTRAR_CONTROLLER_START_BLOCK,
address: "0x4cCb0BB02FCABA27e82a56646E81d8c5bC4119a5",
startBlock: 18619035,
},
},
});
Expand Down
8 changes: 4 additions & 4 deletions src/ponder-ens-plugins/eth/ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ export const config = createConfig({
[ns("RegistryOld")]: {
network: "mainnet",
abi: Registry,
address: REGISTRY_OLD_ADDRESS,
address: "0x314159265dd8dbb310642f98f50c066173c1259b",
startBlock: 3327417,
},
[ns("Registry")]: {
network: "mainnet",
abi: Registry,
address: REGISTRY_ADDRESS,
address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
startBlock: 9380380,
},
[ns("OldRegistryResolvers")]: {
network: "mainnet",
abi: RESOLVER_ABI,
address: factory({
address: REGISTRY_OLD_ADDRESS,
address: "0x314159265dd8dbb310642f98f50c066173c1259b",
event: getAbiItem({ abi: Registry, name: "NewResolver" }),
parameter: "resolver",
}),
Expand All @@ -53,7 +53,7 @@ export const config = createConfig({
network: "mainnet",
abi: RESOLVER_ABI,
address: factory({
address: REGISTRY_ADDRESS,
address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
event: getAbiItem({ abi: Registry, name: "NewResolver" }),
parameter: "resolver",
}),
Expand Down