-
Notifications
You must be signed in to change notification settings - Fork 5
/
schema.graphql
100 lines (87 loc) · 2.66 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
type Token @entity {
id: ID! # The address of the token
owner: Safe!
}
type User @entity {
id: ID! # The address of the user
safes: [Safe!]!
safeAddresses: [String!]
}
type Safe @entity {
id: ID! # The address of the safe
deployed: Boolean
organization: Boolean
owners: [User!]! @derivedFrom(field: "safes")
outgoing: [Trust!]! @derivedFrom(field: "user") # All the paths tokens can travel from this user
incoming: [Trust!]! @derivedFrom(field: "canSendTo") # All the paths tokens can travel to this user
outgoingAddresses: [String!]!
balances: [Balance!]! @derivedFrom(field: "owner")
}
type Balance @entity {
id: ID! # Concatenation of token address and holder address
amount: BigInt!
owner: Safe!
token: Token!
}
interface Event {
id: ID! # Concatenation of block number and log ID
}
type Signup implements Event @entity {
id: ID! # Concatenation of block number and log ID
safe: String!
token: String!
}
type OrganizationSignup implements Event @entity {
id: ID! # Concatenation of block number and log ID
safe: String!
}
type Trust implements Event @entity {
id: ID! # Concatenation of token address, user address and canSendTo address
canSendToAddress: String!
canSendTo: Safe # The safe who is doing the trusting, ie. when I trust you, you can send to me
userAddress: String!
user: Safe # The safe who is receiving trust
limit: BigInt # The amount in freckles that can currently be sent along this edge - this changes with transactions
limitPercentage: BigInt! # The amount of trust, expressed as a percentage - this only changes when a user adjusts it
}
enum NotificationType {
HUB_TRANSFER
OWNERSHIP
TRANSFER
TRUST
}
type TrustChange implements Event @entity {
id: ID! # Concatenation of block number and log ID
canSendTo: String!
user: String!
limitPercentage: BigInt!
}
type Transfer implements Event @entity {
id: ID! # Concatenation of block number and log ID
from: String!
to: String!
amount: BigInt!
}
type HubTransfer implements Event @entity {
id: ID! # Concatenation of block number and log ID
from: String!
to: String!
amount: BigInt!
}
type OwnershipChange implements Event @entity {
id: ID! # Concatenation of block number and log ID
adds: String
removes: String
}
type Notification implements Event @entity {
id: ID! # Concatenation of notification type, block number and log ID
safe: Safe
safeAddress: String!
type: NotificationType! # One of the fields trust, transfer, hubTransfer, or ownership will be populated based on notification type
time: BigInt!
transactionHash: String!
trust: TrustChange
transfer: Transfer
hubTransfer: HubTransfer
ownership: OwnershipChange
}