Skip to content

Commit

Permalink
Merge pull request #108 from helium/mbthiery/max-supply-improvement
Browse files Browse the repository at this point in the history
Add record whenever supply increases
  • Loading branch information
mbthiery committed Dec 5, 2023
2 parents 6c57fd1 + f734341 commit cb25968
Showing 1 changed file with 8 additions and 3 deletions.
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 cb25968

Please sign in to comment.