Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add record whenever supply increases #108

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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