-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.graphql
77 lines (70 loc) · 1.6 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
type Create @entity(immutable: true) {
id: Bytes!
assetId: BigInt! # uint256
sender: Bytes! # address
arTxId: String! # string
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
type Remove @entity(immutable: true) {
id: Bytes!
assetId: BigInt! # uint256
sender: Bytes! # address
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
type Trade @entity(immutable: true) {
id: Bytes!
tradeType: Int! # uint8
assetId: BigInt! # uint256
user: User! # address
tokenAmount: BigDecimal!
ethAmount: BigDecimal!
creatorFee: BigDecimal!
price: BigDecimal!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
type Transfer @entity(immutable: true) {
id: Bytes!
operator: Bytes! # address
from: Bytes! # address
to: Bytes! # address
assetId: BigInt! # uint256
amount: BigInt! # uint256
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
type User @entity {
id: ID!
address: Bytes! # address
creatorProfit: BigDecimal!
tradingPnl: BigDecimal!
totalTrades: BigInt!
assets: [UserAsset!]! @derivedFrom(field: "user")
trades: [Trade!]! @derivedFrom(field: "user")
}
type UserAsset @entity {
id: ID! # `user.id.concat(asset.id)`
assetId: BigInt!
user: User!
asset: Asset!
amount: BigDecimal!
avgPrice: BigDecimal!
}
type Asset @entity {
id: ID!
assetId: BigInt!
arTxId: String
creator: User
totalSupply: BigDecimal!
totalTrades: BigInt!
totalFees: BigDecimal!
totalVolume: BigDecimal!
totalHolders: BigInt!
holders: [UserAsset!]! @derivedFrom(field: "asset")
}