-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
178 lines (165 loc) · 3.83 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
enum SwapMethod {
TransformERC20
UniswapVIP
PancakeSwapVIP
LiquidityProvider
BatchFill
MultiHopFill
Uniswap3VIP
}
enum NativeOrderType {
RfqOrder
OtcOrder
LimitOrder
}
enum TokenType {
ERC20
ERC721
ERC1155
}
enum TradeDirection {
Buy
Sell
}
type Transaction @entity {
# tx hash
id: ID!
blockNumber: BigInt!
timestamp: BigInt!
fills: [Fill!]!
nativeOrderFills: [NativeOrderFill!]! @derivedFrom(field: "transaction")
erc721OrderFills: [ERC721OrderFill!]! @derivedFrom(field: "transaction")
erc1155OrderFills: [ERC1155OrderFill!]! @derivedFrom(field: "transaction")
swaps: [Swap!]! @derivedFrom(field: "transaction")
lastSwap: Swap
}
type Token @entity {
# token address
# In case of NFTs: tokenAddress-id
id: ID!
nftId: BigInt
tokenURI: String
collection: Collection
symbol: String!
decimals: BigInt!
rfqOrderVolume: BigInt!
otcOrderVolume: BigInt!
limitOrderVolume: BigInt!
swapVolume: BigInt!
type: TokenType!
}
type Collection @entity {
# collection address
id: ID!
name: String
symbol: String!
type: TokenType!
nfts: [Token!]! @derivedFrom(field: "collection")
}
type Taker @entity {
# taker address
id: ID!
swapCount: BigInt!
nativeOrderFillCount: BigInt!
erc721OrderFillCount: BigInt!
erc1155OrderFillCount: BigInt!
swaps: [Swap!]! @derivedFrom(field: "taker")
erc721OrderFills: [ERC721OrderFill!]! @derivedFrom(field: "taker")
erc1155OrderFills: [ERC1155OrderFill!]! @derivedFrom(field: "taker")
nativeOrderFills: [NativeOrderFill!]! @derivedFrom(field: "taker")
}
type Maker @entity {
# maker address
id: ID!
erc721OrderFillCount: BigInt!
erc1155OrderFillCount: BigInt!
nativeOrderFillCount: BigInt!
nativeOrderFills: [NativeOrderFill!]! @derivedFrom(field: "maker")
erc721OrderFills: [ERC721OrderFill!]! @derivedFrom(field: "maker")
erc1155OrderFills: [ERC1155OrderFill!]! @derivedFrom(field: "maker")
}
type Fill @entity {
# tx hash - source - log index
id: ID!
blockNumber: BigInt!
timestamp: BigInt!
transaction: Transaction!
logIndex: BigInt
source: String!
recipient: Bytes!
# For native order fills this is the maker.
# For liquidity provider fills this is the provider address.
# For bridge fills this is the source ID.
provider: Bytes
sender: Bytes
inputToken: Token!
outputToken: Token!
inputTokenAmount: BigInt!
outputTokenAmount: BigInt!
}
type NativeOrderFill @entity {
# tx hash - order hash - log index
id: ID!
transaction: Transaction!
timestamp: BigInt!
blockNumber: BigInt!
type: NativeOrderType!
orderHash: Bytes!
taker: Taker!
maker: Maker!
inputToken: Token!
outputToken: Token!
inputTokenAmount: BigInt!
outputTokenAmount: BigInt!
pool: Bytes!
fee: BigInt!
}
type ERC721OrderFill @entity {
# tx hash - order hash - log index
id: ID!
transaction: Transaction!
tradeDirection: TradeDirection!
timestamp: BigInt!
blockNumber: BigInt!
orderHash: Bytes!
taker: Taker!
maker: Maker!
erc20Token: Token!
erc721Token: Token!
erc20TokenAmount: BigInt!
nonce: BigInt!
}
type ERC1155OrderFill @entity {
# tx hash - order hash - log index
id: ID!
transaction: Transaction!
tradeDirection: TradeDirection!
timestamp: BigInt!
blockNumber: BigInt!
orderHash: Bytes!
taker: Taker!
maker: Maker!
erc20Token: Token!
erc1155Token: Token!
erc1155TokenAmount: BigInt!
erc20TokenAmount: BigInt!
nonce: BigInt!
}
type Swap @entity {
# tx hash - tx swap #
id: ID!
blockNumber: BigInt!
transaction: Transaction!
timestamp: BigInt!
logIndex: BigInt
method: SwapMethod!
fills: [Fill!]!
inputToken: Token!
outputToken: Token!
inputTokenAmount: BigInt!
outputTokenAmount: BigInt!
taker: Taker!
# For uniswap VIP swaps this is either 'Sushiswap' or 'UniswapV2'.
# For LiquidityProvider VIP swaps this is the provider address.
hint: String
}