This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
90 lines (83 loc) · 2.07 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
type OpenFarm @entity {
id: ID!
totalFarmCount: BigInt!
totalErc20Count: BigInt!
}
type StatPool @entity{
id: ID!
creater: String!
spotPoolId: String!
}
type TemplateAToken @entity {
id: ID!
symbol: String
name: String
decimals: Int!
address: String!
totalSupply: BigInt!
issuer: Bytes!
timestamp: BigInt!
}
type FarmPool @entity {
id: ID!
farmPoolId: Int! # for sorting
spotPoolId: String! # spot pool address
rewardsToken: String!
stakingToken: String!
creater: String!
startBlock: Int!
endBlock: Int!
rewardsDuration: Int! # duration = start - block + 1
rewardRatio: Int!
totalSupply: BigInt!
unlockRatio: BigInt!
halflifeK: Int!
halflifeRatio: Int!
stakes: [FarmStake!] @derivedFrom(field: "farmPoolId")
streams: [RewardStream!] @derivedFrom(field: "farmPoolId")
proposals:[VoteProposal!] @derivedFrom(field: "farmPoolId")
tx: Bytes # Farm Pool creation transaction id
}
type FarmStake @entity {
id: ID! # poolId + userAddress
userAddress: User!
farmPoolId: FarmPool!
amount: BigDecimal!
}
type RewardStream @entity {
id: ID!
userAddress: User!
farmPoolId: FarmPool!
streamId: Int! # 0 means not exist
amount: BigDecimal!
}
type User @entity {
id: ID!
staked: [FarmStake!] @derivedFrom(field: "userAddress")
streamed: [RewardStream!] @derivedFrom(field: "userAddress")
txs: [Transaction!] @derivedFrom(field: "userAddress")
}
type VoteProposal @entity {
id: ID!
farmPoolId: FarmPool!
}
type Transaction @entity {
id: ID! # Log ID
tx: Bytes!
event: String
block: BigInt!
timestamp: BigInt!
gasUsed: BigDecimal!
gasPrice: BigDecimal!
farmPoolId: Int
userAddress: User
action: TrxType
sender: Bytes
}
enum TrxType {
farmPoolStake,
farmPoolWithdraw,
farmPoolExit,
rewardPaid,
rewardToStream
}