-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
125 lines (113 loc) · 2.81 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
type _Schema_
@fulltext(
name: "collectionSearch"
language: en
algorithm: rank
include: [{ entity: "Collection", fields: [{ name: "name" }] }]
)
enum NftStandard {
ERC1155
ERC721
}
# General Entities: referenced from any handler
type Account @entity {
"Wallet Address"
id: ID!
"Collections created by account"
projects: [Collection!]! @derivedFrom(field: "creator")
metaTxs: [MetaTransaction!]! @derivedFrom(field: "from")
transfersFrom: [Transfer!]! @derivedFrom(field: "senderAddress")
transfersTo: [Transfer!]! @derivedFrom(field: "receiverAddress")
balances: [Balance!]! @derivedFrom(field: "account")
approvals: [Approval!]! @derivedFrom(field: "account")
}
type Contract @entity(immutable: true){
"Contract Address"
id: ID!
"Collection reference if it's a collection"
collection: Collection
}
# All collection is a contract, All contract need not be a collection
type Collection @entity {
"Collection Address"
id: ID!
creator: Account!
name: String!
type: NftStandard!
contract: [Contract!]! @derivedFrom(field: "collection")
currentSupply: BigInt!
}
# Forwarder Entity
type MetaTransaction @entity(immutable: true){
"TxHash-logIndex of the event MetaTransaction"
id: ID!
from: Account!
to: Contract!
nonce: BigInt!
signature: Bytes!
}
# Token Entities
type Token @entity{
"polygon/collectionAddr/tokenId"
id: ID!
collection: Collection!
identifier: BigInt!
transfers: [Transfer!]! @derivedFrom(field: "token")
balances: [Balance!]! @derivedFrom(field: "token")
}
type Transfer @entity(immutable: true){
id: ID!
transaction: Transaction!
collection: Collection!
token: Token!
operator: Account
senderAddress: Account!
receiverAddress: Account!
value: BigInt!
}
type Balance @entity {
"polygon/collectionAddr/tokenId/accountAddr"
id: ID!
token: Token!
account: Account!
value: BigInt!
}
type Approval @entity {
"collectionAddr/accountAddr/operatorAddr"
id: ID!
account: Account!
collection: Collection!
operator: Account!
approved: Boolean!
}
type Transaction @entity(immutable: true){
id: ID!
timestamp: Int!
blockNumber: Int!
transactionFrom: Account!
# Not deriving because of some loop, subgraph deployment fails
transfers: [Transfer!]!
gasPrice: BigInt
}
# type ClaimedWithReferral @entity(immutable: true){
# id: ID!
# from: Account! # address
# tokenAddress: Bytes! # address
# tokenId: BigInt! # uint256
# by: Account! # address
# referral: String! # string
# }
# type Sale @entity(immutable: true){
# id: ID!
# orderHash: Bytes!
# offerer: Account!
# fulfiller: Account!
# offer: Token!
# "Number of Tokens sold"
# quantity: BigInt!
# "Total Paid Amount only native for now"
# totalAmount: BigInt!
# platformFee: BigInt!
# saleAmount: BigInt!
# royaltyAmount: BigInt
# }