Skip to content

Commit ad3b398

Browse files
committed
schema, codegen, processor
1 parent 992ef40 commit ad3b398

File tree

83 files changed

+1249
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1249
-568
lines changed

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"trailingComma": "all",
44
"tabWidth": 2,
55
"semi": false,
6+
"printWidth": 120,
67
"importOrder": [
78
"<THIRD_PARTY_MODULES>",
89
"^@",

graphql.config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ projects:
2020
include:
2121
- schema-general.graphql
2222
- types.graphql
23+
ogn:
24+
schema: schema-exponential-staking.graphql
25+
include:
26+
- schema-general.graphql
27+
- types.graphql
2328
ogv:
2429
schema: schema-ogv.graphql
2530
include:

schema-exponential-staking.graphql

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# State
2+
# - Contract
3+
# - Lockups
4+
# - Accounts
5+
6+
type ExponentialStaking @entity {
7+
id: ID!
8+
chainId: Int! @index
9+
address: String! @index
10+
timestamp: DateTime! @index
11+
blockNumber: Int! @index
12+
accRewardPerShare: BigInt!
13+
assetBalance: BigInt!
14+
}
15+
16+
enum ExponentialStakingLockupState {
17+
Open
18+
Closed
19+
}
20+
21+
type ExponentialStakingLockup @entity {
22+
id: ID! # `chainId:address:account:lockupId` or `lockupId`
23+
chainId: Int! @index
24+
address: String! @index
25+
account: String! @index
26+
lockupId: BigInt! @index
27+
amount: BigInt!
28+
end: BigInt!
29+
points: BigInt!
30+
withdrawAmount: BigInt!
31+
penalty: BigInt!
32+
state: ExponentialStakingLockupState
33+
}
34+
35+
type ExponentialStakingAccount @entity {
36+
id: ID! # `chainId:address:account`
37+
chainId: Int! @index
38+
address: String! @index
39+
account: String! @index
40+
votes: BigInt!
41+
balance: BigInt!
42+
previewPoints: BigInt!
43+
previewRewards: BigInt!
44+
previewWithdraw: BigInt!
45+
}
46+
47+
48+
49+
### Events
50+
type ExponentialStakingDelegateChanged @entity {
51+
id: ID! # `chainId:address:account`
52+
chainId: Int! @index
53+
address: String! @index
54+
delegator: String! @index
55+
fromDelegate: String!
56+
toDelegate: String!
57+
}
58+
59+
type ExponentialStakingDelegateVotesChanged @entity {
60+
id: ID! # `chainId:address:account`
61+
chainId: Int! @index
62+
address: String! @index
63+
delegate: String! @index
64+
previousBalance: BigInt!
65+
newBalance: BigInt!
66+
}
67+
68+
type ExponentialStakingPenalty @entity {
69+
id: ID! # `chainId:address:account`
70+
chainId: Int! @index
71+
address: String! @index
72+
account: String! @index
73+
amount: BigInt!
74+
}
75+
76+
type ExponentialStakingReward @entity {
77+
id: ID! # `chainId:address:account`
78+
chainId: Int! @index
79+
address: String! @index
80+
account: String! @index
81+
amount: BigInt!
82+
}
83+
84+
type ExponentialStakingStake @entity {
85+
id: ID! # `chainId:address:account`
86+
chainId: Int! @index
87+
address: String! @index
88+
account: String! @index
89+
lockupId: BigInt! @index
90+
amount: BigInt!
91+
end: BigInt!
92+
points: BigInt!
93+
}
94+
95+
type ExponentialStakingUnstake @entity {
96+
id: ID! # `chainId:address:account`
97+
chainId: Int! @index
98+
address: String! @index
99+
account: String! @index
100+
lockupId: BigInt! @index
101+
amount: BigInt!
102+
end: BigInt!
103+
points: BigInt!
104+
}

schema.graphql

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,109 @@
11
# GENERATED, DO NOT MODIFY
22

3+
# State
4+
# - Contract
5+
# - Lockups
6+
# - Accounts
7+
8+
type ExponentialStaking @entity {
9+
id: ID!
10+
chainId: Int! @index
11+
address: String! @index
12+
timestamp: DateTime! @index
13+
blockNumber: Int! @index
14+
accRewardPerShare: BigInt!
15+
assetBalance: BigInt!
16+
}
17+
18+
enum ExponentialStakingLockupState {
19+
Open
20+
Closed
21+
}
22+
23+
type ExponentialStakingLockup @entity {
24+
id: ID! # `chainId:address:account:lockupId` or `lockupId`
25+
chainId: Int! @index
26+
address: String! @index
27+
account: String! @index
28+
lockupId: BigInt! @index
29+
amount: BigInt!
30+
end: BigInt!
31+
points: BigInt!
32+
withdrawAmount: BigInt!
33+
penalty: BigInt!
34+
state: ExponentialStakingLockupState
35+
}
36+
37+
type ExponentialStakingAccount @entity {
38+
id: ID! # `chainId:address:account`
39+
chainId: Int! @index
40+
address: String! @index
41+
account: String! @index
42+
votes: BigInt!
43+
balance: BigInt!
44+
previewPoints: BigInt!
45+
previewRewards: BigInt!
46+
previewWithdraw: BigInt!
47+
}
48+
49+
50+
51+
### Events
52+
type ExponentialStakingDelegateChanged @entity {
53+
id: ID! # `chainId:address:account`
54+
chainId: Int! @index
55+
address: String! @index
56+
delegator: String! @index
57+
fromDelegate: String!
58+
toDelegate: String!
59+
}
60+
61+
type ExponentialStakingDelegateVotesChanged @entity {
62+
id: ID! # `chainId:address:account`
63+
chainId: Int! @index
64+
address: String! @index
65+
delegate: String! @index
66+
previousBalance: BigInt!
67+
newBalance: BigInt!
68+
}
69+
70+
type ExponentialStakingPenalty @entity {
71+
id: ID! # `chainId:address:account`
72+
chainId: Int! @index
73+
address: String! @index
74+
account: String! @index
75+
amount: BigInt!
76+
}
77+
78+
type ExponentialStakingReward @entity {
79+
id: ID! # `chainId:address:account`
80+
chainId: Int! @index
81+
address: String! @index
82+
account: String! @index
83+
amount: BigInt!
84+
}
85+
86+
type ExponentialStakingStake @entity {
87+
id: ID! # `chainId:address:account`
88+
chainId: Int! @index
89+
address: String! @index
90+
account: String! @index
91+
lockupId: BigInt! @index
92+
amount: BigInt!
93+
end: BigInt!
94+
points: BigInt!
95+
}
96+
97+
type ExponentialStakingUnstake @entity {
98+
id: ID! # `chainId:address:account`
99+
chainId: Int! @index
100+
address: String! @index
101+
account: String! @index
102+
lockupId: BigInt! @index
103+
amount: BigInt!
104+
end: BigInt!
105+
points: BigInt!
106+
}
3107
type ProcessingStatus @entity {
4108
id: ID!
5109
timestamp: DateTime!
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export enum ExponentialStakingLockupState {
2+
Open = "Open",
3+
Closed = "Closed",
4+
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm"
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_, Index as Index_, IntColumn as IntColumn_} from "@subsquid/typeorm-store"
22

33
@Entity_()
44
export class BalancerPool {
@@ -10,24 +10,24 @@ export class BalancerPool {
1010
id!: string
1111

1212
@Index_()
13-
@Column_("text", {nullable: false})
13+
@StringColumn_({nullable: false})
1414
address!: string
1515

16-
@Column_("text", {nullable: false})
16+
@StringColumn_({nullable: false})
1717
name!: string
1818

19-
@Column_("int4", {nullable: false})
19+
@IntColumn_({nullable: false})
2020
tokenCount!: number
2121

22-
@Column_("text", {nullable: false})
22+
@StringColumn_({nullable: false})
2323
token0!: string
2424

25-
@Column_("text", {nullable: false})
25+
@StringColumn_({nullable: false})
2626
token1!: string
2727

28-
@Column_("text", {nullable: true})
28+
@StringColumn_({nullable: true})
2929
token2!: string | undefined | null
3030

31-
@Column_("text", {nullable: true})
31+
@StringColumn_({nullable: true})
3232
token3!: string | undefined | null
3333
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm"
2-
import * as marshal from "./marshal"
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, DateTimeColumn as DateTimeColumn_, Index as Index_, IntColumn as IntColumn_, StringColumn as StringColumn_, BigIntColumn as BigIntColumn_} from "@subsquid/typeorm-store"
32

43
@Entity_()
54
export class BalancerPoolBalance {
@@ -11,25 +10,25 @@ export class BalancerPoolBalance {
1110
id!: string
1211

1312
@Index_()
14-
@Column_("timestamp with time zone", {nullable: false})
13+
@DateTimeColumn_({nullable: false})
1514
timestamp!: Date
1615

1716
@Index_()
18-
@Column_("int4", {nullable: false})
17+
@IntColumn_({nullable: false})
1918
blockNumber!: number
2019

21-
@Column_("text", {nullable: false})
20+
@StringColumn_({nullable: false})
2221
address!: string
2322

24-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
23+
@BigIntColumn_({nullable: false})
2524
balance0!: bigint
2625

27-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
26+
@BigIntColumn_({nullable: false})
2827
balance1!: bigint
2928

30-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
29+
@BigIntColumn_({nullable: false})
3130
balance2!: bigint
3231

33-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
32+
@BigIntColumn_({nullable: false})
3433
balance3!: bigint
3534
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_} from "typeorm"
2-
import * as marshal from "./marshal"
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, DateTimeColumn as DateTimeColumn_, Index as Index_, IntColumn as IntColumn_, StringColumn as StringColumn_, BigIntColumn as BigIntColumn_} from "@subsquid/typeorm-store"
32

43
@Entity_()
54
export class BalancerPoolRate {
@@ -11,25 +10,25 @@ export class BalancerPoolRate {
1110
id!: string
1211

1312
@Index_()
14-
@Column_("timestamp with time zone", {nullable: false})
13+
@DateTimeColumn_({nullable: false})
1514
timestamp!: Date
1615

1716
@Index_()
18-
@Column_("int4", {nullable: false})
17+
@IntColumn_({nullable: false})
1918
blockNumber!: number
2019

21-
@Column_("text", {nullable: false})
20+
@StringColumn_({nullable: false})
2221
address!: string
2322

24-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
23+
@BigIntColumn_({nullable: false})
2524
rate0!: bigint
2625

27-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
26+
@BigIntColumn_({nullable: false})
2827
rate1!: bigint
2928

30-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
29+
@BigIntColumn_({nullable: false})
3130
rate2!: bigint
3231

33-
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
32+
@BigIntColumn_({nullable: false})
3433
rate3!: bigint
3534
}

0 commit comments

Comments
 (0)