Skip to content

Commit

Permalink
Index AccountDeployed event
Browse files Browse the repository at this point in the history
  • Loading branch information
Destiner committed Mar 18, 2024
1 parent 1c3fd35 commit f8764a7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ponder.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSchema } from "@ponder/core";
import { createSchema } from '@ponder/core';

export default createSchema((p) => ({
UserOp: p.createTable({
Expand All @@ -14,4 +14,15 @@ export default createSchema((p) => ({
success: p.boolean(),
entryPoint: p.hex(),
}),
AccountDeployed: p.createTable({
id: p.string(),
hash: p.hex(),
chainId: p.int(),
txHash: p.hex(),
factory: p.hex(),
paymaster: p.hex(),
sender: p.hex(),
userOpHash: p.hex(),
entryPoint: p.hex(),
}),
}));
16 changes: 16 additions & 0 deletions src/entryPoint_0_6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ if (isIndexing0_6) {
},
});
});

ponder.on('EntryPoint0.6:AccountDeployed', async ({ event, context }) => {
await context.db.AccountDeployed.create({
id: `${context.network.chainId}-${event.args.userOpHash}`,
data: {
hash: event.transaction.hash,
chainId: context.network.chainId,
txHash: event.transaction.hash,
factory: event.args.factory,
paymaster: event.args.paymaster,
sender: event.args.sender,
userOpHash: event.args.userOpHash,
entryPoint: event.log.address,
},
});
});
}
16 changes: 16 additions & 0 deletions src/entryPoint_0_7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ if (isIndexing0_7) {
},
});
});

ponder.on('EntryPoint0.7:AccountDeployed', async ({ event, context }) => {
await context.db.AccountDeployed.create({
id: `${context.network.chainId}-${event.args.userOpHash}`,
data: {
hash: event.transaction.hash,
chainId: context.network.chainId,
txHash: event.transaction.hash,
factory: event.args.factory,
paymaster: event.args.paymaster,
sender: event.args.sender,
userOpHash: event.args.userOpHash,
entryPoint: event.log.address,
},
});
});
}

0 comments on commit f8764a7

Please sign in to comment.