Skip to content

Commit 1bc4c93

Browse files
committed
add supply to protocol schema, remove amoSupply from tvl for otokens, use totalAssets for ARM tvl
1 parent bf4fc25 commit 1bc4c93

File tree

6 files changed

+13
-175
lines changed

6 files changed

+13
-175
lines changed
Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ type ProtocolDailyStatDetail @entity {
8787
product: String! @index
8888
timestamp: DateTime! @index
8989
rateUSD: BigInt!
90+
supply: BigInt!
9091
earningTvl: BigInt!
9192
tvl: BigInt!
9293
yield: BigInt! # Yield generated by the product, including fees.

src/mainnet/processors/protocol/REFERENCE.md

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/mainnet/processors/protocol/protocol.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type ProtocolDailyStatDetail @entity {
1717
product: String! @index
1818
timestamp: DateTime! @index
1919
rateUSD: BigInt!
20+
supply: BigInt!
2021
earningTvl: BigInt!
2122
tvl: BigInt!
2223
yield: BigInt! # Yield generated by the product, including fees.

src/mainnet/processors/protocol/protocol.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ const getOTokenDetails = async (
167167
const eth = (value: bigint) => (value * otokenDailyStat.rateETH) / BigInt(10 ** 18)
168168
detail.rateUSD = otokenDailyStat.rateUSD
169169
detail.earningTvl = eth(otokenDailyStat.rebasingSupply)
170-
detail.tvl = eth(otokenDailyStat.totalSupply)
170+
detail.tvl = eth(otokenDailyStat.totalSupply - (otokenDailyStat.amoSupply ?? 0n))
171+
detail.supply = eth(otokenDailyStat.totalSupply)
171172
detail.yield = eth(otokenDailyStat.yield + otokenDailyStat.fees)
172173
detail.revenue = eth(otokenDailyStat.fees)
173174
detail.apy = otokenDailyStat.apy
@@ -253,8 +254,9 @@ const getArmDetails = async (
253254
}
254255
const detail = await getProtocolDailyStatDetail(ctx, date, product)
255256
detail.rateUSD = BigInt(Math.round(armDailyStat.rateUSD * 1e18))
256-
detail.earningTvl = armDailyStat.totalSupply
257-
detail.tvl = armDailyStat.totalSupply
257+
detail.earningTvl = armDailyStat.totalAssets
258+
detail.tvl = armDailyStat.totalAssets
259+
detail.supply = armDailyStat.totalSupply
258260
detail.yield = armDailyStat.yield + armDailyStat.fees
259261
detail.revenue = armDailyStat.fees
260262
detail.apy = armDailyStat.apy

src/model/generated/protocolDailyStatDetail.model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export class ProtocolDailyStatDetail {
2424
@BigIntColumn_({nullable: false})
2525
rateUSD!: bigint
2626

27+
@BigIntColumn_({nullable: false})
28+
supply!: bigint
29+
2730
@BigIntColumn_({nullable: false})
2831
earningTvl!: bigint
2932

0 commit comments

Comments
 (0)