Skip to content

Commit a88e7d3

Browse files
committed
- copy ogv governance into a governance schema
- reorganize so this schema file count isn't so messy
1 parent ad3b398 commit a88e7d3

19 files changed

+288
-54
lines changed

graphql.config.yml

+4-29
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
projects:
2-
combined:
3-
schema: schema.graphql
4-
base:
5-
schema: schema-general.graphql
6-
include:
7-
- types.graphql
8-
otoken:
9-
schema: schema-otoken.graphql
10-
include:
11-
- schema-general.graphql
12-
- types.graphql
13-
oeth:
14-
schema: schema-oeth.graphql
2+
separate:
3+
schema: schema/*.graphql
154
include:
16-
- schema-general.graphql
175
- types.graphql
18-
ousd:
19-
schema: schema-ousd.graphql
20-
include:
21-
- schema-general.graphql
22-
- types.graphql
23-
ogn:
24-
schema: schema-exponential-staking.graphql
25-
include:
26-
- schema-general.graphql
27-
- types.graphql
28-
ogv:
29-
schema: schema-ogv.graphql
6+
combined:
7+
schema: schema.graphql
308
include:
31-
- schema-general.graphql
329
- types.graphql
33-
include:
34-
- types.graphql

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "origin-squid",
33
"private": true,
44
"scripts": {
5-
"codegen": "echo '# GENERATED, DO NOT MODIFY\n' > schema.graphql && cat schema-*.graphql >> schema.graphql && sqd codegen && git add src/model/generated/*",
5+
"codegen": "echo '# GENERATED, DO NOT MODIFY\n' > schema.graphql && cat schema/*.graphql >> schema.graphql && sqd codegen && git add src/model/generated/*",
66
"migration:generate": "sqd down && sqd up && sqd migration:generate && git add db/migrations/*",
77
"generate": "npm-run-all codegen migration:generate",
88
"build": "rm -rf lib && tsc",

schema.graphql

+64-8
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ type ExponentialStakingAccount @entity {
4848

4949

5050

51-
### Events
51+
# Events
5252
type ExponentialStakingDelegateChanged @entity {
53-
id: ID! # `chainId:address:account`
53+
id: ID! # `chainId:logId`
5454
chainId: Int! @index
5555
address: String! @index
5656
delegator: String! @index
@@ -59,7 +59,7 @@ type ExponentialStakingDelegateChanged @entity {
5959
}
6060

6161
type ExponentialStakingDelegateVotesChanged @entity {
62-
id: ID! # `chainId:address:account`
62+
id: ID! # `chainId:logId`
6363
chainId: Int! @index
6464
address: String! @index
6565
delegate: String! @index
@@ -68,23 +68,23 @@ type ExponentialStakingDelegateVotesChanged @entity {
6868
}
6969

7070
type ExponentialStakingPenalty @entity {
71-
id: ID! # `chainId:address:account`
71+
id: ID! # `chainId:logId`
7272
chainId: Int! @index
7373
address: String! @index
7474
account: String! @index
7575
amount: BigInt!
7676
}
7777

7878
type ExponentialStakingReward @entity {
79-
id: ID! # `chainId:address:account`
79+
id: ID! # `chainId:logId`
8080
chainId: Int! @index
8181
address: String! @index
8282
account: String! @index
8383
amount: BigInt!
8484
}
8585

8686
type ExponentialStakingStake @entity {
87-
id: ID! # `chainId:address:account`
87+
id: ID! # `chainId:logId`
8888
chainId: Int! @index
8989
address: String! @index
9090
account: String! @index
@@ -95,7 +95,7 @@ type ExponentialStakingStake @entity {
9595
}
9696

9797
type ExponentialStakingUnstake @entity {
98-
id: ID! # `chainId:address:account`
98+
id: ID! # `chainId:logId`
9999
chainId: Int! @index
100100
address: String! @index
101101
account: String! @index
@@ -386,7 +386,63 @@ type BridgeTransferState @entity {
386386
txHash: String! @index
387387
state: Int!
388388
}
389-
# OETH Vault: 0x39254033945AA2E4809Cc2977E7087BEE48bd7Ab
389+
enum GovernanceProposalState {
390+
Pending
391+
Active
392+
Canceled
393+
Defeated
394+
Succeeded
395+
Queued
396+
Expired
397+
Executed
398+
}
399+
400+
enum GovernanceProposalEvent {
401+
Created
402+
Queued
403+
Canceled
404+
Extended
405+
Executed
406+
}
407+
408+
enum GovernanceVoteType {
409+
Against
410+
For
411+
Abstain
412+
}
413+
414+
type GovernanceProposalTxLog @entity {
415+
id: ID!
416+
hash: String!
417+
event: GovernanceProposalEvent!
418+
timestamp: DateTime!
419+
proposal: GovernanceProposal! @index
420+
}
421+
422+
type GovernanceProposal @entity {
423+
id: ID! @index
424+
description: String
425+
proposer: String!
426+
timestamp: DateTime!
427+
startBlock: BigInt!
428+
endBlock: BigInt!
429+
lastUpdated: DateTime!
430+
status: GovernanceProposalState!
431+
logs: [GovernanceProposalTxLog]! @derivedFrom(field: "proposal")
432+
quorum: BigInt!
433+
choices: [String]!
434+
scores: [Float]!
435+
}
436+
437+
type GovernanceProposalVote @entity {
438+
id: ID!
439+
proposal: GovernanceProposal! @index
440+
voter: String! @index
441+
weight: BigInt!
442+
type: GovernanceVoteType!
443+
txHash: String!
444+
timestamp: DateTime!
445+
}# OETH Vault: 0x39254033945AA2E4809Cc2977E7087BEE48bd7Ab
390446
"""
391447
The Vault entity tracks the OETH vault balance over time.
392448
"""

schema-exponential-staking.graphql renamed to schema/exponential-staking.graphql

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ type ExponentialStakingAccount @entity {
4646

4747

4848

49-
### Events
49+
# Events
5050
type ExponentialStakingDelegateChanged @entity {
51-
id: ID! # `chainId:address:account`
51+
id: ID! # `chainId:logId`
5252
chainId: Int! @index
5353
address: String! @index
5454
delegator: String! @index
@@ -57,7 +57,7 @@ type ExponentialStakingDelegateChanged @entity {
5757
}
5858

5959
type ExponentialStakingDelegateVotesChanged @entity {
60-
id: ID! # `chainId:address:account`
60+
id: ID! # `chainId:logId`
6161
chainId: Int! @index
6262
address: String! @index
6363
delegate: String! @index
@@ -66,23 +66,23 @@ type ExponentialStakingDelegateVotesChanged @entity {
6666
}
6767

6868
type ExponentialStakingPenalty @entity {
69-
id: ID! # `chainId:address:account`
69+
id: ID! # `chainId:logId`
7070
chainId: Int! @index
7171
address: String! @index
7272
account: String! @index
7373
amount: BigInt!
7474
}
7575

7676
type ExponentialStakingReward @entity {
77-
id: ID! # `chainId:address:account`
77+
id: ID! # `chainId:logId`
7878
chainId: Int! @index
7979
address: String! @index
8080
account: String! @index
8181
amount: BigInt!
8282
}
8383

8484
type ExponentialStakingStake @entity {
85-
id: ID! # `chainId:address:account`
85+
id: ID! # `chainId:logId`
8686
chainId: Int! @index
8787
address: String! @index
8888
account: String! @index
@@ -93,7 +93,7 @@ type ExponentialStakingStake @entity {
9393
}
9494

9595
type ExponentialStakingUnstake @entity {
96-
id: ID! # `chainId:address:account`
96+
id: ID! # `chainId:logId`
9797
chainId: Int! @index
9898
address: String! @index
9999
account: String! @index
File renamed without changes.

schema/governance.graphql

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
enum GovernanceProposalState {
2+
Pending
3+
Active
4+
Canceled
5+
Defeated
6+
Succeeded
7+
Queued
8+
Expired
9+
Executed
10+
}
11+
12+
enum GovernanceProposalEvent {
13+
Created
14+
Queued
15+
Canceled
16+
Extended
17+
Executed
18+
}
19+
20+
enum GovernanceVoteType {
21+
Against
22+
For
23+
Abstain
24+
}
25+
26+
type GovernanceProposalTxLog @entity {
27+
id: ID!
28+
hash: String!
29+
event: GovernanceProposalEvent!
30+
timestamp: DateTime!
31+
proposal: GovernanceProposal! @index
32+
}
33+
34+
type GovernanceProposal @entity {
35+
id: ID! @index
36+
description: String
37+
proposer: String!
38+
timestamp: DateTime!
39+
startBlock: BigInt!
40+
endBlock: BigInt!
41+
lastUpdated: DateTime!
42+
status: GovernanceProposalState!
43+
logs: [GovernanceProposalTxLog]! @derivedFrom(field: "proposal")
44+
quorum: BigInt!
45+
choices: [String]!
46+
scores: [Float]!
47+
}
48+
49+
type GovernanceProposalVote @entity {
50+
id: ID!
51+
proposal: GovernanceProposal! @index
52+
voter: String! @index
53+
weight: BigInt!
54+
type: GovernanceVoteType!
55+
txHash: String!
56+
timestamp: DateTime!
57+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export enum GovernanceProposalEvent {
2+
Created = "Created",
3+
Queued = "Queued",
4+
Canceled = "Canceled",
5+
Extended = "Extended",
6+
Executed = "Executed",
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export enum GovernanceProposalState {
2+
Pending = "Pending",
3+
Active = "Active",
4+
Canceled = "Canceled",
5+
Defeated = "Defeated",
6+
Succeeded = "Succeeded",
7+
Queued = "Queued",
8+
Expired = "Expired",
9+
Executed = "Executed",
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum GovernanceVoteType {
2+
Against = "Against",
3+
For = "For",
4+
Abstain = "Abstain",
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_, DateTimeColumn as DateTimeColumn_, BigIntColumn as BigIntColumn_, OneToMany as OneToMany_, FloatColumn as FloatColumn_} from "@subsquid/typeorm-store"
2+
import {GovernanceProposalState} from "./_governanceProposalState"
3+
import {GovernanceProposalTxLog} from "./governanceProposalTxLog.model"
4+
5+
@Entity_()
6+
export class GovernanceProposal {
7+
constructor(props?: Partial<GovernanceProposal>) {
8+
Object.assign(this, props)
9+
}
10+
11+
@PrimaryColumn_()
12+
id!: string
13+
14+
@StringColumn_({nullable: true})
15+
description!: string | undefined | null
16+
17+
@StringColumn_({nullable: false})
18+
proposer!: string
19+
20+
@DateTimeColumn_({nullable: false})
21+
timestamp!: Date
22+
23+
@BigIntColumn_({nullable: false})
24+
startBlock!: bigint
25+
26+
@BigIntColumn_({nullable: false})
27+
endBlock!: bigint
28+
29+
@DateTimeColumn_({nullable: false})
30+
lastUpdated!: Date
31+
32+
@Column_("varchar", {length: 9, nullable: false})
33+
status!: GovernanceProposalState
34+
35+
@OneToMany_(() => GovernanceProposalTxLog, e => e.proposal)
36+
logs!: GovernanceProposalTxLog[]
37+
38+
@BigIntColumn_({nullable: false})
39+
quorum!: bigint
40+
41+
@StringColumn_({array: true, nullable: false})
42+
choices!: (string | undefined | null)[]
43+
44+
@FloatColumn_({array: true, nullable: false})
45+
scores!: (number | undefined | null)[]
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_, DateTimeColumn as DateTimeColumn_, ManyToOne as ManyToOne_, Index as Index_} from "@subsquid/typeorm-store"
2+
import {GovernanceProposalEvent} from "./_governanceProposalEvent"
3+
import {GovernanceProposal} from "./governanceProposal.model"
4+
5+
@Entity_()
6+
export class GovernanceProposalTxLog {
7+
constructor(props?: Partial<GovernanceProposalTxLog>) {
8+
Object.assign(this, props)
9+
}
10+
11+
@PrimaryColumn_()
12+
id!: string
13+
14+
@StringColumn_({nullable: false})
15+
hash!: string
16+
17+
@Column_("varchar", {length: 8, nullable: false})
18+
event!: GovernanceProposalEvent
19+
20+
@DateTimeColumn_({nullable: false})
21+
timestamp!: Date
22+
23+
@Index_()
24+
@ManyToOne_(() => GovernanceProposal, {nullable: true})
25+
proposal!: GovernanceProposal
26+
}

0 commit comments

Comments
 (0)