Skip to content

Commit

Permalink
Add record whenever supply increases
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthiery committed Dec 5, 2023
1 parent 68dc3d3 commit f734341
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/stats/components/HntInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { fetchHntGovernanceStats } from "../utils/fetchGovernanceMetrics"
import { fetchMint } from "../utils/fetchMint"
import { getNextHalvening } from "../utils/getNextHalvening"
import {
getRemainingEmissions,
MAX_DAILY_NET_EMISSIONS,
getRemainingEmissions,
} from "../utils/remainingEmissions"
import { Countdown } from "./Countdown"

Expand Down
11 changes: 8 additions & 3 deletions src/knex/maxSupply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ export class MaxSupply {
record.hnt_burned > (latestBurn?.hnt_burned || BigInt(0))

if (
(!latest && !latestBurn) || // first time app is run
(!isSameDay && (latestBurn?.supply || 0) < record.supply) || // when new UTC day + supply has been disbursed
(isSameDay && hasBurnIncrease) // true when different hnt burn result and guards against dune query failure
// first time app is run
(!latest && !latestBurn) ||
// when new UTC day + supply has been disbursed
(!isSameDay && (latestBurn?.supply || 0) < record.supply) ||
// true when different hnt burn result and guards against dune query failure
(isSameDay && hasBurnIncrease) ||
// true when first recording of the day happens between treasury and HST emissions
(isSameDay && (latest?.supply || 0) < record.supply)
) {
await this.addRecord(record)
if (record.hnt_burned === BigInt(0)) return record
Expand Down

0 comments on commit f734341

Please sign in to comment.