-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.graphql
More file actions
116 lines (108 loc) · 3.95 KB
/
schema.graphql
File metadata and controls
116 lines (108 loc) · 3.95 KB
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
enum BridgeType {
XDAI
AMB
}
type Transfer {
id: ID! # messageId
transactionHash: Bytes # Tx hash where the bridge operation started (it will be set/undefined depending on the bridge side)
timestamp: BigInt # timestamp when the bridge operation started (it will be set/undefined depending on the bridge side)
bridgeName: String # Bridge Name (xDai, OmniBridge, AMB)
sender: Bytes
amount: BigInt
token: Bytes
}
type Transaction {
id: ID! # messageId
messageId: Bytes # AMB id
transactionHash: Bytes # Tx hash where the bridge operation started (it will be set/undefined depending on the bridge side)
timestamp: BigInt # timestamp when the bridge operation started (it will be set/undefined depending on the bridge side)
bridgeName: String # Bridge Name (xDai, OmniBridge, AMB)
transactionStatus: TransactionStatus
# initiator info
initiator: Bytes # Sender Address
initiatorNetwork: String # Origin Network Name (mainnet, xdai, chiado, goerli)
initiatorAmount: BigInt # Amount sent
initiatorToken: Bytes # ERC20 token address
# receiver info
receiver: Bytes # Receiver Address
receiverNetwork: String # Dest Network Name (mainnet, xdai, chiado, goerli)
receiverAmount: BigInt # Amount sent
receiverToken: Bytes # ERC20 token address
# validations & execution
# validations: [TransactionValidation!] @derivedFrom(field: "transaction")
execution: TransactionExecution # This is the "end" of the bridge operation. It can be seen as the "claim". In Home is executed by the validator when the threshold is reached. In Foreign is executed by the user manually.
}
type Validator @entity(immutable: false) {
id: ID! # Validator Address
name: String # See Config folder
bridgeType: BridgeType # xDai, AMB, Omnibridge
address: Bytes!
lastActivity: BigInt # Last time Validator Signed|Executed a Tx
# signed: [TransactionValidation!]! @derivedFrom(field: "validator") # tx signed (24hs)
# executed: [TransactionExecution!]! @derivedFrom(field: "executor") # tx executed (24hs)
hashAdded: String!
hashRemoved: String
removed: Boolean
}
enum TransactionStatus {
INITIATED
COLLECTING
UNCLAIMED
COMPLETED
ERROR
}
type TransactionValidation @entity(immutable: false) {
id: ID! # tx.id + '-' + validator.id
transaction: Transaction!
transactionHash: Bytes
validator: Validator!
validatorAddr: Bytes # helper to allow filtering by validator address TODO: make this required
timestamp: BigInt!
}
type TransactionExecution @entity(immutable: false) {
id: ID! # tx.id + '-' + validator.id
transaction: Transaction! # Tx hash where the bridge operation ended
transactionHash: Bytes!
timestamp: BigInt! # timestamp when the bridge operation ended
# if Foreign > Home set validator (The last signer). if Home > Foreign set Null.
# todo: rename to validator.
executor: Validator
validatorAddr: Bytes # helper to allow filtering by validator address
}
type XDAITransaction @entity(immutable: false) {
id: ID! # Transaction Hash
transactionHash: Bytes
bridgeName: String
initiator: Bytes
initiatorNetwork: String
initiatorAmount: BigInt
initiatorToken: Bytes
receiver: Bytes
receiverNetwork: String
receiverAmount: BigInt
receiverToken: Bytes
# transactionStatus: TransactionStatus
timestamp: BigInt
# validations: [TransactionValidation!] @derivedFrom(field: "transaction")
# execution: TransactionExecution
messageId: Bytes
# nonce: Bytes | undefined # Nonce parameter for UserRequestForSignatureWithNonce events
}
type AMBTransaction @entity(immutable: false) {
id: ID! # Message ID
transactionHash: Bytes
bridgeName: String
initiator: Bytes
initiatorNetwork: String
initiatorAmount: BigInt
initiatorToken: Bytes
receiver: Bytes
receiverNetwork: String
receiverAmount: BigInt
receiverToken: Bytes
transactionStatus: TransactionStatus
timestamp: BigInt
# validations: [TransactionValidation!] @derivedFrom(field: "transaction")
execution: TransactionExecution
messageId: Bytes
}