-
Notifications
You must be signed in to change notification settings - Fork 3
/
schema.graphql
19 lines (18 loc) · 1.12 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Define a Transfer type representing the transfer of tokens
type Transfer @entity(immutable: true) {
id: ID! # Unique identifier for the transfer entity
from: Account! # Reference to the Account entity sending the tokens
to: Account! # Reference to the Account entity receiving the tokens
value: BigInt! # Amount of tokens transferred
timestamp: BigInt! # Timestamp when the transfer occurred
}
# Define an Account type representing a user account
type Account @entity {
id: ID! # Unique identifier for the account entity
sentTransfers: [Transfer!]! @derivedFrom(field: "from") # Array of transfers sent by the account # Use @derivedFrom to create a relationship from Transfer 'from' field
receivedTransfers: [Transfer!]! @derivedFrom(field: "to") # Array of transfers received by the account # Use @derivedFrom to create a relationship from Transfer 'to' field
totalSent: BigInt! # Total amount of tokens sent by the account
totalReceived: BigInt! # Total amount of tokens received by the account
sentCount: Int! # Number of transfers sent by the account
receivedCount: Int! # Number of transfers received by the account
}