Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestognw committed Jun 8, 2024
1 parent 74e747a commit 3d39bbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions ponder.schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSchema } from "@ponder/core";

export default createSchema((p) => ({
Account: p.createTable({
Wallet: p.createTable({
id: p.hex(),
tokens: p.many("Token.ownerId"),

Expand All @@ -10,16 +10,16 @@ export default createSchema((p) => ({
}),
Token: p.createTable({
id: p.bigint(),
ownerId: p.hex().references("Account.id"),
ownerId: p.hex().references("Wallet.id"),

owner: p.one("ownerId"),
transferEvents: p.many("TransferEvent.tokenId"),
}),
TransferEvent: p.createTable({
id: p.string(),
timestamp: p.int(),
fromId: p.hex().references("Account.id"),
toId: p.hex().references("Account.id"),
fromId: p.hex().references("Wallet.id"),
toId: p.hex().references("Wallet.id"),
tokenId: p.bigint().references("Token.id"),

from: p.one("fromId"),
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ponder } from "@/generated";

ponder.on("ERC721:Transfer", async ({ event, context }) => {
const { Account, Token, TransferEvent } = context.db;
const { Wallet, Token, TransferEvent } = context.db;

// Create an Account for the sender, or update the balance if it already exists.
await Account.upsert({
// Create an Wallet for the sender, or update the balance if it already exists.
await Wallet.upsert({
id: event.args.from,
});

// Create an Account for the recipient, or update the balance if it already exists.
await Account.upsert({
// Create an Wallet for the recipient, or update the balance if it already exists.
await Wallet.upsert({
id: event.args.to,
});

Expand Down

0 comments on commit 3d39bbd

Please sign in to comment.