-
Notifications
You must be signed in to change notification settings - Fork 1
/
ponder.schema.ts
145 lines (144 loc) · 3.99 KB
/
ponder.schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import { createSchema } from "@ponder/core";
export default createSchema((p) => ({
Token: p.createTable({
id: p.hex(),
name: p.string(),
symbol: p.string(),
decimals: p.int(),
poolTokens: p.many("PoolToken.tokenId"),
}),
Pool: p.createTable({
id: p.bigint(),
strategyId: p.hex().references("Strategy.id"),
strategy: p.one("strategyId"),
poolTokens: p.many("PoolToken.poolId"),
tokens: p.hex().list(),
reserves: p.float().list(),
reservesWad: p.bigint().list(),
liquidity: p.float(),
liquidityWad: p.bigint(),
liquidityTokenSupply: p.float(),
liquidityTokenSupplyWad: p.bigint(),
lpToken: p.hex(),
name: p.string(),
positions: p.many("Position.poolId"),
initTimestamp: p.bigint(),
}),
Swap: p.createTable({
id: p.hex(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
sender: p.hex(),
amountIn: p.float(),
amountInWad: p.bigint(),
amountOut: p.float(),
amountOutWad: p.bigint(),
tokenIn: p.hex(),
tokenOut: p.hex(),
timestamp: p.bigint(),
block: p.bigint(),
}),
Allocate: p.createTable({
id: p.hex(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
sender: p.hex(),
deltas: p.float().list(),
deltasWad: p.bigint().list(),
deltaLiquidity: p.float(),
deltaLiquidityWad: p.bigint(),
timestamp: p.bigint(),
block: p.bigint()
}),
Deallocate: p.createTable({
id: p.hex(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
sender: p.hex(),
deltas: p.float().list().optional(),
deltasWad: p.bigint().list().optional(),
deltaLiquidity: p.float(),
deltaLiquidityWad: p.bigint(),
timestamp: p.bigint(),
block: p.bigint()
}),
PoolToken: p.createTable({
id: p.string(),
tokenId: p.hex().references("Token.id"),
poolId: p.bigint().references("Pool.id"),
token: p.one("tokenId"),
pool: p.one("poolId"),
}),
Strategy: p.createTable({
id: p.hex(),
name: p.string(),
pools: p.many("Pool.strategyId"),
}),
Position: p.createTable({
id: p.hex(),
liquidity: p.float(),
liquidityWad: p.bigint(),
accountId: p.hex().references("Account.id"),
account: p.one("accountId"),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
}),
Account: p.createTable({
id: p.hex(),
positions: p.many("Position.accountId"),
swapPoints: p.bigint(),
wrPoints: p.bigint(),
slPoints: p.bigint(),
pointsTotal: p.bigint(),
}),
ConstantSumParams: p.createTable({
id: p.bigint(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
swapFee: p.bigint(),
controller: p.hex(),
lastComputedPrice: p.float(),
lastComputedPriceWad: p.bigint(),
priceUpdatePerSecond: p.float(),
priceUpdatePerSecondWad: p.bigint(),
priceUpdateEnd: p.int(),
lastPriceUpdate: p.int(),
}),
GeometricMeanParams: p.createTable({
id: p.bigint(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
swapFee: p.bigint(),
controller: p.hex(),
lastComputedWeightX: p.bigint(),
weightXUpdatePerSecond: p.bigint(),
weightXUpdateEnd: p.int(),
lastWeightXUpdate: p.int(),
}),
NTokenGeometricMeanParams: p.createTable({
id: p.bigint(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
swapFee: p.bigint(),
controller: p.hex(),
lastComputedWeights: p.bigint().list(),
weightsUpdatePerSecond: p.bigint().list(),
weightsUpdateEnd: p.int(),
lastWeightsUpdate: p.int(),
}),
LogNormalParams: p.createTable({
id: p.bigint(),
poolId: p.bigint().references("Pool.id"),
pool: p.one("poolId"),
swapFee: p.bigint(),
controller: p.hex(),
lastComputedMean: p.bigint(),
lastComputedWidth: p.bigint(),
meanUpdatePerSecond: p.bigint(),
widthUpdatePerSecond: p.bigint(),
meanUpdateEnd: p.int(),
widthUpdateEnd: p.int(),
lastMeanUpdate: p.int(),
lastWidthUpdate: p.int(),
}),
}));