-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
93 lines (85 loc) · 2.48 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
type Fund @entity {
id: ID! #address of the cloned Fund
name: String!
manager: Manager! # address of the msg.sender who created the fund
creation_timestamp: BigInt! # block.timestamp for when the fund was created
closed_timestamp: BigInt # indicates when the fund was closed, null means not closed yet
subscriptions: [Sub!]! @derivedFrom(field: "fund")
total_collateral_raised: BigInt!
manager_fee_percentage: BigInt!
subscription_constraints: SubConstraints! @derivedFrom(field: "fund")
rules: [Rule!]! @derivedFrom(field: "fund") # to keep track of all the ruleHashes created via roboCop
positions: [Position!]! @derivedFrom(field: "fund")
}
type Position @entity {
id: ID! # positionHash stored in the contracts
next_actions: [Bytes!]! # array of possible actions that can be done
fund: Fund!
creation_timestamp: BigInt!
closed_timestamp: BigInt
}
type SubConstraints @entity {
id: ID!
minCollateralPerSub: BigInt!
maxCollateralPerSub: BigInt!
minCollateralTotal: BigInt!
maxCollateralTotal: BigInt!
deadline: BigInt!
lockin: BigInt!
fund: Fund!
}
# Because "Subscription" is a reserved keyword...
type Sub @entity {
id: ID!
address: Bytes!
fund: Fund!
deposit_timestamps: [BigInt!]!
deposit_amounts: [BigInt!]!
withdraw_timestamps: [BigInt!]!
}
type Rule @entity {
id: ID! # ruleHash
creation_timestamp: BigInt!
activation_timestamps: [BigInt!]!
deactivation_timestamps: [BigInt!]!
execution_timestamp: BigInt
redemption_timestamp: BigInt
actions: [Action!]! @derivedFrom(field: "rule")
triggers: [Trigger!]! @derivedFrom(field: "rule")
outputs: [BigInt!]!
collaterals: [BigInt!]
# what about all the other kinds of events? collateralAdd/reduce
fund: Fund!
}
type Action @entity {
id: ID! # random shit that doesn't mean anything
callee: Bytes!
data: Bytes!
input_tokens: [Token!]! @derivedFrom(field: "input_of")
output_tokens: [Token!]! @derivedFrom(field: "output_of")
rule: Rule!
}
type Trigger @entity {
id: ID! # random shit that doesn't mean anything
type: BigInt!
callee: Bytes!
create_time_params: Bytes!
rule: Rule!
}
type Token @entity {
id: ID! # concat of address-type-nftId
address: Bytes!
type: BigInt!
nft_id: BigInt # only used for ERC721, else null
input_of: [Action!]!
output_of: [Action!]!
}
type Manager @entity {
id: ID!
socialHandle: String
chatroomInvite: String
customLink: String
aboutText: String
strategyText: String
funds: [Fund!]! @derivedFrom(field: "manager")
}