create-ponder 0.6.24 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -17
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/empty/ponder.schema.ts +4 -6
- package/templates/etherscan/ponder.schema.ts +4 -6
- package/templates/feature-api-functions/package.json +2 -0
- package/templates/feature-api-functions/ponder-env.d.ts +2 -3
- package/templates/feature-api-functions/ponder.schema.ts +35 -44
- package/templates/feature-api-functions/src/api/index.ts +10 -15
- package/templates/feature-api-functions/src/index.ts +46 -53
- package/templates/feature-blocks/ponder-env.d.ts +2 -3
- package/templates/feature-blocks/ponder.config.ts +1 -1
- package/templates/feature-blocks/ponder.schema.ts +4 -6
- package/templates/feature-blocks/src/index.ts +4 -5
- package/templates/feature-call-traces/ponder-env.d.ts +2 -3
- package/templates/feature-call-traces/ponder.schema.ts +7 -9
- package/templates/feature-call-traces/src/index.ts +12 -11
- package/templates/feature-factory/ponder-env.d.ts +2 -3
- package/templates/feature-factory/ponder.schema.ts +3 -5
- package/templates/feature-filter/ponder-env.d.ts +2 -3
- package/templates/feature-filter/ponder.schema.ts +5 -7
- package/templates/feature-filter/src/index.ts +4 -7
- package/templates/feature-multichain/ponder.schema.ts +4 -6
- package/templates/feature-multichain/src/index.ts +5 -11
- package/templates/feature-proxy/ponder-env.d.ts +2 -3
- package/templates/feature-proxy/ponder.schema.ts +12 -10
- package/templates/feature-proxy/src/index.ts +7 -16
- package/templates/feature-read-contract/ponder-env.d.ts +2 -3
- package/templates/feature-read-contract/ponder.schema.ts +9 -12
- package/templates/feature-read-contract/src/FileStore.ts +16 -20
- package/templates/project-friendtech/ponder-env.d.ts +2 -3
- package/templates/project-friendtech/ponder.schema.ts +43 -55
- package/templates/project-friendtech/src/FriendtechSharesV1.ts +56 -70
- package/templates/project-uniswap-v3-flash/ponder-env.d.ts +2 -3
- package/templates/project-uniswap-v3-flash/ponder.schema.ts +9 -10
- package/templates/project-uniswap-v3-flash/src/index.ts +25 -34
- package/templates/reference-erc1155/ponder-env.d.ts +2 -3
- package/templates/reference-erc1155/ponder.schema.ts +19 -23
- package/templates/reference-erc1155/src/index.ts +60 -76
- package/templates/reference-erc20/package.json +1 -0
- package/templates/reference-erc20/ponder-env.d.ts +2 -3
- package/templates/reference-erc20/ponder.schema.ts +35 -44
- package/templates/reference-erc20/src/index.ts +40 -57
- package/templates/reference-erc4626/ponder-env.d.ts +2 -3
- package/templates/reference-erc4626/ponder.schema.ts +43 -54
- package/templates/reference-erc4626/src/index.ts +41 -65
- package/templates/reference-erc721/ponder-env.d.ts +2 -3
- package/templates/reference-erc721/ponder.schema.ts +14 -25
- package/templates/reference-erc721/src/index.ts +21 -25
- package/templates/subgraph/ponder.schema.ts +4 -6
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onchainTable, primaryKey } from "@ponder/core";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tokens: p.many("TokenBalance.ownerId"),
|
|
3
|
+
export const account = onchainTable("account", (t) => ({
|
|
4
|
+
address: t.hex().primaryKey(),
|
|
5
|
+
}));
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export const tokenBalance = onchainTable(
|
|
8
|
+
"token_balance",
|
|
9
|
+
(t) => ({
|
|
10
|
+
tokenId: t.bigint().notNull(),
|
|
11
|
+
owner: t.hex().notNull(),
|
|
12
|
+
balance: t.bigint().notNull(),
|
|
10
13
|
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
tokenId: p.bigint(),
|
|
14
|
-
balance: p.bigint(),
|
|
15
|
-
|
|
16
|
-
ownerId: p.hex().references("Account.id"),
|
|
17
|
-
owner: p.one("ownerId"),
|
|
14
|
+
(table) => ({
|
|
15
|
+
pk: primaryKey({ columns: [table.owner, table.tokenId] }),
|
|
18
16
|
}),
|
|
19
|
-
|
|
20
|
-
id: p.string(),
|
|
21
|
-
timestamp: p.int(),
|
|
22
|
-
fromId: p.hex().references("Account.id"),
|
|
23
|
-
toId: p.hex().references("Account.id"),
|
|
24
|
-
tokenId: p.bigint(),
|
|
17
|
+
);
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
export const transferEvent = onchainTable("transfer_event", (t) => ({
|
|
20
|
+
id: t.text().primaryKey(),
|
|
21
|
+
timestamp: t.integer().notNull(),
|
|
22
|
+
from: t.hex().notNull(),
|
|
23
|
+
to: t.hex().notNull(),
|
|
24
|
+
token: t.bigint().notNull(),
|
|
29
25
|
}));
|
|
@@ -1,109 +1,93 @@
|
|
|
1
1
|
import { ponder } from "@/generated";
|
|
2
|
+
import * as schema from "../ponder.schema";
|
|
2
3
|
|
|
3
4
|
ponder.on("ERC1155:TransferSingle", async ({ event, context }) => {
|
|
4
|
-
const { Account, TokenBalance, TransferEvent } = context.db;
|
|
5
|
-
|
|
6
5
|
// Create an Account for the sender, or update the balance if it already exists.
|
|
7
|
-
await
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
await context.db
|
|
7
|
+
.insert(schema.account)
|
|
8
|
+
.values({ address: event.args.from })
|
|
9
|
+
.onConflictDoNothing();
|
|
10
10
|
|
|
11
|
-
await
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
await context.db
|
|
12
|
+
.insert(schema.tokenBalance)
|
|
13
|
+
.values({
|
|
14
|
+
owner: event.args.from,
|
|
14
15
|
tokenId: event.args.id,
|
|
15
|
-
ownerId: event.args.from,
|
|
16
16
|
balance: -event.args.amount,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
balance: current.balance - event.args.amount,
|
|
22
|
-
}),
|
|
23
|
-
});
|
|
17
|
+
})
|
|
18
|
+
.onConflictDoUpdate((row) => ({
|
|
19
|
+
balance: row.balance - event.args.amount,
|
|
20
|
+
}));
|
|
24
21
|
|
|
25
22
|
// Create an Account for the recipient, or update the balance if it already exists.
|
|
26
|
-
await
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
await context.db
|
|
24
|
+
.insert(schema.account)
|
|
25
|
+
.values({ address: event.args.to })
|
|
26
|
+
.onConflictDoNothing();
|
|
29
27
|
|
|
30
|
-
await
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
await context.db
|
|
29
|
+
.insert(schema.tokenBalance)
|
|
30
|
+
.values({
|
|
31
|
+
owner: event.args.to,
|
|
33
32
|
tokenId: event.args.id,
|
|
34
|
-
ownerId: event.args.to,
|
|
35
33
|
balance: event.args.amount,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
balance: current.balance + event.args.amount,
|
|
41
|
-
}),
|
|
42
|
-
});
|
|
34
|
+
})
|
|
35
|
+
.onConflictDoUpdate((row) => ({
|
|
36
|
+
balance: row.balance + event.args.amount,
|
|
37
|
+
}));
|
|
43
38
|
|
|
44
39
|
// Create a TransferEvent.
|
|
45
|
-
await
|
|
40
|
+
await context.db.insert(schema.transferEvent).values({
|
|
46
41
|
id: event.log.id,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
timestamp: Number(event.block.timestamp),
|
|
52
|
-
},
|
|
42
|
+
from: event.args.from,
|
|
43
|
+
to: event.args.to,
|
|
44
|
+
token: event.args.id,
|
|
45
|
+
timestamp: Number(event.block.timestamp),
|
|
53
46
|
});
|
|
54
47
|
});
|
|
55
48
|
|
|
56
49
|
ponder.on("ERC1155:TransferBatch", async ({ event, context }) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
50
|
+
await context.db
|
|
51
|
+
.insert(schema.account)
|
|
52
|
+
.values({ address: event.args.from })
|
|
53
|
+
.onConflictDoNothing();
|
|
54
|
+
await context.db
|
|
55
|
+
.insert(schema.account)
|
|
56
|
+
.values({ address: event.args.to })
|
|
57
|
+
.onConflictDoNothing();
|
|
66
58
|
|
|
67
59
|
for (let i = 0; i < event.args.ids.length; i++) {
|
|
68
60
|
const id = event.args.ids[i]!;
|
|
69
61
|
const amount = event.args.amounts[i]!;
|
|
70
62
|
|
|
71
|
-
await
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
await context.db
|
|
64
|
+
.insert(schema.tokenBalance)
|
|
65
|
+
.values({
|
|
66
|
+
owner: event.args.from,
|
|
74
67
|
tokenId: id,
|
|
75
|
-
ownerId: event.args.from,
|
|
76
68
|
balance: -amount,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
balance: current.balance - amount,
|
|
82
|
-
}),
|
|
83
|
-
});
|
|
69
|
+
})
|
|
70
|
+
.onConflictDoUpdate((row) => ({
|
|
71
|
+
balance: row.balance - amount,
|
|
72
|
+
}));
|
|
84
73
|
|
|
85
|
-
await
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
await context.db
|
|
75
|
+
.insert(schema.tokenBalance)
|
|
76
|
+
.values({
|
|
77
|
+
owner: event.args.to,
|
|
88
78
|
tokenId: id,
|
|
89
|
-
ownerId: event.args.to,
|
|
90
79
|
balance: amount,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
balance: current.balance + amount,
|
|
96
|
-
}),
|
|
97
|
-
});
|
|
80
|
+
})
|
|
81
|
+
.onConflictDoUpdate((row) => ({
|
|
82
|
+
balance: row.balance + amount,
|
|
83
|
+
}));
|
|
98
84
|
|
|
99
|
-
await
|
|
100
|
-
id:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
timestamp: Number(event.block.timestamp),
|
|
106
|
-
},
|
|
85
|
+
await context.db.insert(schema.transferEvent).values({
|
|
86
|
+
id: event.log.id,
|
|
87
|
+
from: event.args.from,
|
|
88
|
+
to: event.args.to,
|
|
89
|
+
token: id,
|
|
90
|
+
timestamp: Number(event.block.timestamp),
|
|
107
91
|
});
|
|
108
92
|
}
|
|
109
93
|
});
|
|
@@ -7,7 +7,7 @@ declare module "@/generated" {
|
|
|
7
7
|
import type { Virtual } from "@ponder/core";
|
|
8
8
|
|
|
9
9
|
type config = typeof import("./ponder.config.ts").default;
|
|
10
|
-
type schema = typeof import("./ponder.schema.ts")
|
|
10
|
+
type schema = typeof import("./ponder.schema.ts");
|
|
11
11
|
|
|
12
12
|
export const ponder: Virtual.Registry<config, schema>;
|
|
13
13
|
|
|
@@ -21,8 +21,7 @@ declare module "@/generated" {
|
|
|
21
21
|
schema,
|
|
22
22
|
name
|
|
23
23
|
>;
|
|
24
|
-
export type ApiContext = Virtual.
|
|
24
|
+
export type ApiContext = Virtual.ApiContext<schema>;
|
|
25
25
|
export type IndexingFunctionArgs<name extends EventNames = EventNames> =
|
|
26
26
|
Virtual.IndexingFunctionArgs<config, schema, name>;
|
|
27
|
-
export type Schema = Virtual.Schema<schema>;
|
|
28
27
|
}
|
|
@@ -1,50 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { index, onchainTable, primaryKey } from "@ponder/core";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export const account = onchainTable("account", (t) => ({
|
|
4
|
+
address: t.hex().primaryKey(),
|
|
5
|
+
balance: t.bigint().notNull(),
|
|
6
|
+
isOwner: t.boolean().notNull(),
|
|
7
|
+
}));
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export const allowance = onchainTable(
|
|
10
|
+
"allowance",
|
|
11
|
+
(t) => ({
|
|
12
|
+
owner: t.hex(),
|
|
13
|
+
spender: t.hex(),
|
|
14
|
+
amount: t.bigint().notNull(),
|
|
14
15
|
}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
amount: p.bigint(),
|
|
18
|
-
|
|
19
|
-
ownerId: p.hex().references("Account.id"),
|
|
20
|
-
spenderId: p.hex().references("Account.id"),
|
|
21
|
-
|
|
22
|
-
owner: p.one("ownerId"),
|
|
23
|
-
spender: p.one("spenderId"),
|
|
16
|
+
(table) => ({
|
|
17
|
+
pk: primaryKey({ columns: [table.owner, table.spender] }),
|
|
24
18
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
),
|
|
39
|
-
ApprovalEvent: p.createTable({
|
|
40
|
-
id: p.string(),
|
|
41
|
-
amount: p.bigint(),
|
|
42
|
-
timestamp: p.int(),
|
|
43
|
-
|
|
44
|
-
ownerId: p.hex().references("Account.id"),
|
|
45
|
-
spenderId: p.hex().references("Account.id"),
|
|
46
|
-
|
|
47
|
-
owner: p.one("ownerId"),
|
|
48
|
-
spender: p.one("spenderId"),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const transferEvent = onchainTable(
|
|
22
|
+
"transfer_event",
|
|
23
|
+
(t) => ({
|
|
24
|
+
id: t.text().primaryKey(),
|
|
25
|
+
amount: t.bigint().notNull(),
|
|
26
|
+
timestamp: t.integer().notNull(),
|
|
27
|
+
from: t.hex().notNull(),
|
|
28
|
+
to: t.hex().notNull(),
|
|
29
|
+
}),
|
|
30
|
+
(table) => ({
|
|
31
|
+
fromIdx: index("from_index").on(table.from),
|
|
49
32
|
}),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const approvalEvent = onchainTable("approval_event", (t) => ({
|
|
36
|
+
id: t.text().primaryKey(),
|
|
37
|
+
amount: t.bigint().notNull(),
|
|
38
|
+
timestamp: t.integer().notNull(),
|
|
39
|
+
owner: t.hex().notNull(),
|
|
40
|
+
spender: t.hex().notNull(),
|
|
50
41
|
}));
|
|
@@ -1,70 +1,53 @@
|
|
|
1
1
|
import { ponder } from "@/generated";
|
|
2
|
+
import {
|
|
3
|
+
account,
|
|
4
|
+
allowance,
|
|
5
|
+
approvalEvent,
|
|
6
|
+
transferEvent,
|
|
7
|
+
} from "../ponder.schema";
|
|
2
8
|
|
|
3
9
|
ponder.on("ERC20:Transfer", async ({ event, context }) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
await
|
|
20
|
-
id: event.args.to,
|
|
21
|
-
create: {
|
|
22
|
-
balance: event.args.amount,
|
|
23
|
-
isOwner: false,
|
|
24
|
-
},
|
|
25
|
-
update: ({ current }) => ({
|
|
26
|
-
balance: current.balance + event.args.amount,
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Create a TransferEvent.
|
|
31
|
-
await TransferEvent.create({
|
|
10
|
+
await context.db
|
|
11
|
+
.insert(account)
|
|
12
|
+
.values({ address: event.args.from, balance: 0n, isOwner: false })
|
|
13
|
+
.onConflictDoUpdate((row) => ({
|
|
14
|
+
balance: row.balance - event.args.amount,
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
await context.db
|
|
18
|
+
.insert(account)
|
|
19
|
+
.values({ address: event.args.to, balance: 0n, isOwner: false })
|
|
20
|
+
.onConflictDoUpdate((row) => ({
|
|
21
|
+
balance: row.balance + event.args.amount,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// add row to "transfer_event".
|
|
25
|
+
await context.db.insert(transferEvent).values({
|
|
32
26
|
id: event.log.id,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
timestamp: Number(event.block.timestamp),
|
|
38
|
-
},
|
|
27
|
+
amount: event.args.amount,
|
|
28
|
+
timestamp: Number(event.block.timestamp),
|
|
29
|
+
from: event.args.from,
|
|
30
|
+
to: event.args.to,
|
|
39
31
|
});
|
|
40
32
|
});
|
|
41
33
|
|
|
42
34
|
ponder.on("ERC20:Approval", async ({ event, context }) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
id: allowanceId,
|
|
50
|
-
create: {
|
|
51
|
-
ownerId: event.args.owner,
|
|
52
|
-
spenderId: event.args.spender,
|
|
53
|
-
amount: event.args.amount,
|
|
54
|
-
},
|
|
55
|
-
update: {
|
|
35
|
+
// upsert "allowance".
|
|
36
|
+
await context.db
|
|
37
|
+
.insert(allowance)
|
|
38
|
+
.values({
|
|
39
|
+
spender: event.args.spender,
|
|
40
|
+
owner: event.args.owner,
|
|
56
41
|
amount: event.args.amount,
|
|
57
|
-
}
|
|
58
|
-
|
|
42
|
+
})
|
|
43
|
+
.onConflictDoUpdate({ amount: event.args.amount });
|
|
59
44
|
|
|
60
|
-
//
|
|
61
|
-
await
|
|
45
|
+
// add row to "approval_event".
|
|
46
|
+
await context.db.insert(approvalEvent).values({
|
|
62
47
|
id: event.log.id,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
timestamp: Number(event.block.timestamp),
|
|
68
|
-
},
|
|
48
|
+
amount: event.args.amount,
|
|
49
|
+
timestamp: Number(event.block.timestamp),
|
|
50
|
+
owner: event.args.owner,
|
|
51
|
+
spender: event.args.spender,
|
|
69
52
|
});
|
|
70
53
|
});
|
|
@@ -7,7 +7,7 @@ declare module "@/generated" {
|
|
|
7
7
|
import type { Virtual } from "@ponder/core";
|
|
8
8
|
|
|
9
9
|
type config = typeof import("./ponder.config.ts").default;
|
|
10
|
-
type schema = typeof import("./ponder.schema.ts")
|
|
10
|
+
type schema = typeof import("./ponder.schema.ts");
|
|
11
11
|
|
|
12
12
|
export const ponder: Virtual.Registry<config, schema>;
|
|
13
13
|
|
|
@@ -21,8 +21,7 @@ declare module "@/generated" {
|
|
|
21
21
|
schema,
|
|
22
22
|
name
|
|
23
23
|
>;
|
|
24
|
-
export type ApiContext = Virtual.
|
|
24
|
+
export type ApiContext = Virtual.ApiContext<schema>;
|
|
25
25
|
export type IndexingFunctionArgs<name extends EventNames = EventNames> =
|
|
26
26
|
Virtual.IndexingFunctionArgs<config, schema, name>;
|
|
27
|
-
export type Schema = Virtual.Schema<schema>;
|
|
28
27
|
}
|
|
@@ -1,62 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onchainTable, primaryKey } from "@ponder/core";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
isOwner: p.boolean(),
|
|
3
|
+
export const account = onchainTable("account", (t) => ({
|
|
4
|
+
address: t.hex().primaryKey(),
|
|
5
|
+
balance: t.bigint().notNull(),
|
|
6
|
+
}));
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const allowance = onchainTable(
|
|
9
|
+
"allowance",
|
|
10
|
+
(t) => ({
|
|
11
|
+
owner: t.hex(),
|
|
12
|
+
spender: t.hex(),
|
|
13
|
+
amount: t.bigint().notNull(),
|
|
14
14
|
}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
amount: p.bigint(),
|
|
18
|
-
|
|
19
|
-
ownerId: p.hex().references("Account.id"),
|
|
20
|
-
spenderId: p.hex().references("Account.id"),
|
|
21
|
-
|
|
22
|
-
owner: p.one("ownerId"),
|
|
23
|
-
spender: p.one("spenderId"),
|
|
15
|
+
(table) => ({
|
|
16
|
+
pk: primaryKey({ columns: [table.owner, table.spender] }),
|
|
24
17
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const transferEvent = onchainTable("transfer_event", (t) => ({
|
|
21
|
+
id: t.text().primaryKey(),
|
|
22
|
+
amount: t.bigint().notNull(),
|
|
23
|
+
timestamp: t.integer().notNull(),
|
|
24
|
+
from: t.hex().notNull(),
|
|
25
|
+
to: t.hex().notNull(),
|
|
26
|
+
}));
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
export const approvalEvent = onchainTable("approval_event", (t) => ({
|
|
29
|
+
id: t.text().primaryKey(),
|
|
30
|
+
amount: t.bigint().notNull(),
|
|
31
|
+
timestamp: t.integer().notNull(),
|
|
32
|
+
owner: t.hex().notNull(),
|
|
33
|
+
spender: t.hex().notNull(),
|
|
34
|
+
}));
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
export const depositEvent = onchainTable("deposit_event", (t) => ({
|
|
37
|
+
id: t.text().primaryKey(),
|
|
38
|
+
sender: t.hex().notNull(),
|
|
39
|
+
receiver: t.hex().notNull(),
|
|
40
|
+
assets: t.bigint().notNull(),
|
|
41
|
+
shares: t.bigint().notNull(),
|
|
42
|
+
}));
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
assets: p.bigint(),
|
|
52
|
-
shares: p.bigint(),
|
|
53
|
-
}),
|
|
54
|
-
WithdrawEvent: p.createTable({
|
|
55
|
-
id: p.string(),
|
|
56
|
-
sender: p.hex().references("Account.id"),
|
|
57
|
-
receiver: p.hex().references("Account.id"),
|
|
58
|
-
owner: p.hex().references("Account.id"),
|
|
59
|
-
assets: p.bigint(),
|
|
60
|
-
shares: p.bigint(),
|
|
61
|
-
}),
|
|
44
|
+
export const withdrawalEvent = onchainTable("withdrawal_event", (t) => ({
|
|
45
|
+
id: t.text().primaryKey(),
|
|
46
|
+
sender: t.hex().notNull(),
|
|
47
|
+
receiver: t.hex().notNull(),
|
|
48
|
+
owner: t.hex().notNull(),
|
|
49
|
+
assets: t.bigint().notNull(),
|
|
50
|
+
shares: t.bigint().notNull(),
|
|
62
51
|
}));
|