Skip to content

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions schema-oeth.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,101 @@ type OETHBalancerMetaPoolStrategy @entity {
rETH: BigInt!
weth: BigInt!
}

type OETHDailyStat @entity {
id: ID!
"""
Timestamp, eg 2023-10-17
"""
blockNumber: Int! @index
"""
Last block number stats were updated
"""
timestamp: DateTime! @index
"""
Timestamp of block number stats were updated
"""
apr: Float!
apy: Float!
apy7DayAvg: Float!
apy14DayAvg: Float!
apy30DayAvg: Float!

totalSupply: BigInt!
totalSupplyUSD: Float!
rebasingSupply: BigInt!
nonRebasingSupply: BigInt!
amoSupply: BigInt!

yield: BigInt!
fees: BigInt!
revenue: BigInt!
revenue7DayAvg: BigInt!
revenue7DayTotal: BigInt!
revenueAllTime: BigInt!

pegPrice: BigInt!
"""
Price of OETH in ETH
"""
strategies: [OETHStrategyDailyStat] @derivedFrom(field: "dailyStatId")
collateral: [OETHCollateralDailyStat] @derivedFrom(field: "dailyStatId")
}

type OETHStrategyDailyStat @entity {
id: ID!
dailyStatId: OETHDailyStat!
total: BigInt!
"""
Sum of tokens in strategy
"""
tvl: BigInt!
"""
Total ETH value
"""
holdings: [OETHStrategyHoldingDailyStat]
@derivedFrom(field: "strategyDailyStatId")
}

type OETHStrategyHoldingDailyStat @entity {
id: ID!
strategyDailyStatId: OETHStrategyDailyStat!
"""
Token symbol
"""
symbol: String!

"""
Amount held
"""
amount: BigInt!

"""
Total ETH value
"""
value: BigInt!
}

type OETHCollateralDailyStat @entity {
id: ID!
dailyStatId: OETHDailyStat! @index
"""
Token symbol
"""
symbol: String!

"""
Amount held
"""
amount: BigInt!

"""
Price in ETH
"""
price: BigInt!

"""
Total ETH value
"""
value: BigInt!
}
98 changes: 98 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,104 @@ type OETHBalancerMetaPoolStrategy @entity {
rETH: BigInt!
weth: BigInt!
}

type OETHDailyStat @entity {
id: ID!
"""
Timestamp, eg 2023-10-17
"""
blockNumber: Int! @index
"""
Last block number stats were updated
"""
timestamp: DateTime! @index
"""
Timestamp of block number stats were updated
"""
apr: Float!
apy: Float!
apy7DayAvg: Float!
apy14DayAvg: Float!
apy30DayAvg: Float!

totalSupply: BigInt!
totalSupplyUSD: Float!
rebasingSupply: BigInt!
nonRebasingSupply: BigInt!
amoSupply: BigInt!

yield: BigInt!
fees: BigInt!
revenue: BigInt!
revenue7DayAvg: BigInt!
revenue7DayTotal: BigInt!
revenueAllTime: BigInt!

pegPrice: BigInt!
"""
Price of OETH in ETH
"""
strategies: [OETHStrategyDailyStat] @derivedFrom(field: "dailyStatId")
collateral: [OETHCollateralDailyStat] @derivedFrom(field: "dailyStatId")
}

type OETHStrategyDailyStat @entity {
id: ID!
dailyStatId: OETHDailyStat!
total: BigInt!
"""
Sum of tokens in strategy
"""
tvl: BigInt!
"""
Total ETH value
"""
holdings: [OETHStrategyHoldingDailyStat]
@derivedFrom(field: "strategyDailyStatId")
}

type OETHStrategyHoldingDailyStat @entity {
id: ID!
strategyDailyStatId: OETHStrategyDailyStat!
"""
Token symbol
"""
symbol: String!

"""
Amount held
"""
amount: BigInt!

"""
Total ETH value
"""
value: BigInt!
}

type OETHCollateralDailyStat @entity {
id: ID!
dailyStatId: OETHDailyStat! @index
"""
Token symbol
"""
symbol: String!

"""
Amount held
"""
amount: BigInt!

"""
Price in ETH
"""
price: BigInt!

"""
Total ETH value
"""
value: BigInt!
}
# OGV Price (5m?)
# OGV Market Cap (5m?)
# OGV Circulating Supply
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as dailyStats from './post-processors/daily-stats'
import * as exchangeRates from './post-processors/exchange-rates'
import * as validateOeth from './post-processors/validate-oeth'
import { run } from './processor'
Expand Down Expand Up @@ -30,6 +31,6 @@ run({
// OUSD Related
// ousd,
],
postProcessors: [exchangeRates],
postProcessors: [exchangeRates, dailyStats],
validators: [validateOeth],
})
4 changes: 4 additions & 0 deletions src/model/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export * from "./oethFraxStaking.model"
export * from "./oethMorphoAave.model"
export * from "./dripper.model"
export * from "./oethBalancerMetaPoolStrategy.model"
export * from "./oethDailyStat.model"
export * from "./oethStrategyDailyStat.model"
export * from "./oethStrategyHoldingDailyStat.model"
export * from "./oethCollateralDailyStat.model"
export * from "./ogv.model"
export * from "./stakedOgv.model"
export * from "./ogvGovernance.model"
Expand Down
41 changes: 41 additions & 0 deletions src/model/generated/oethCollateralDailyStat.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, ManyToOne as ManyToOne_, Index as Index_} from "typeorm"
import * as marshal from "./marshal"
import {OETHDailyStat} from "./oethDailyStat.model"

@Entity_()
export class OETHCollateralDailyStat {
constructor(props?: Partial<OETHCollateralDailyStat>) {
Object.assign(this, props)
}

@PrimaryColumn_()
id!: string

@Index_()
@ManyToOne_(() => OETHDailyStat, {nullable: true})
dailyStatId!: OETHDailyStat

/**
* Token symbol
*/
@Column_("text", {nullable: false})
symbol!: string

/**
* Amount held
*/
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
amount!: bigint

/**
* Price in ETH
*/
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
price!: bigint

/**
* Total ETH value
*/
@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: false})
value!: bigint
}
Loading