-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphql
129 lines (119 loc) · 2.67 KB
/
schema.graphql
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
type Protocol @entity {
id: Bytes! #factory contract address
pairs: [Pair!] @derivedFrom(field: "protocol")
defaultTradingFeePPM: BigInt!
pairCount: BigInt!
strategyTotalCount: BigInt!
strategyCount: BigInt!
strategyDeletedCount: BigInt!
tradeCount: BigInt!
}
type Token @entity {
id: Bytes!
name: String!
symbol: String!
decimals: Int!
createdAtTimestamp: BigInt!
}
type Pair @entity {
id: String!
protocol: Protocol!
token0: Token!
token1: Token!
strategies: [Strategy!]! @derivedFrom(field: "pair")
orders: [Order!]! @derivedFrom(field: "pair")
trades: [Trade!]! @derivedFrom(field: "pair")
customTradingFeeHistory: [PairTradingFee!]! @derivedFrom(field: "pair")
_defaultTradingFeePPM: BigInt! # uint32
_customTradingFeePPM: BigInt! # uint32
tradingFeePPM: BigInt! # uint32
createdAtTimestamp: BigInt!
blockNumber: BigInt!
transactionHash: Bytes!
}
type StrategyEvent @entity(immutable: true) {
id: Bytes!
eventName: String!
newOwner: Bytes
newOrder0_y: BigInt
newOrder0_z: BigInt
newOrder0_A: BigInt
newOrder0_B: BigInt
newOrder1_y: BigInt
newOrder1_z: BigInt
newOrder1_A: BigInt
newOrder1_B: BigInt
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
type Strategy @entity {
id: String!
owner: User!
pair: Pair!
token0: Token!
token1: Token!
order0: Order!
order1: Order!
events: [StrategyEvent!]!
createdAtTimestamp: BigInt!
updatedAtTimestamp: BigInt
deletedAtTimestamp: BigInt
}
enum OrderType {
order0
order1
}
type Order @entity {
id: String!
type: OrderType!
owner: User!
pair: Pair!
strategy: Strategy!
inputToken: Token!
outputToken: Token!
y: BigInt!
z: BigInt!
A: BigInt!
B: BigInt!
}
type Trade @entity(immutable: true) {
id: Bytes!
trader: User!
pair: Pair!
sourceToken: Token!
targetToken: Token!
sourceAmount: BigInt!
targetAmount: BigInt!
tradingFeeAmount: BigInt!
byTargetAmount: Boolean!
createdAtTimestamp: BigInt!
blockNumber: BigInt!
transactionHash: Bytes!
}
type User @entity {
id: Bytes!
trades: [Trade!]! @derivedFrom(field: "trader")
strategies: [Strategy!]! @derivedFrom(field: "owner")
orders: [Order!]! @derivedFrom(field: "owner")
createdAtTimestamp: BigInt!
}
type TradingFee @entity(immutable: true) {
id: Bytes!
prevFeePPM: BigInt! # uint32
newFeePPM: BigInt! # uint32
blockNumber: BigInt!
createdAtTimestamp: BigInt!
transactionHash: Bytes!
}
type PairTradingFee @entity(immutable: true) {
id: Bytes!
pair: Pair!
token0: Token!
token1: Token!
prevFeePPM: BigInt! # uint32
newFeePPM: BigInt! # uint32
blockNumber: BigInt!
createdAtTimestamp: BigInt!
transactionHash: Bytes!
}