Skip to content

Commit

Permalink
Adjust emissions for actual halvening behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthiery committed Aug 1, 2023
1 parent 8e06f8c commit e0d268b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/app/stats/utils/remainingEmissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
differenceInYears,
isAfter,
isBefore,
sub,
} from "date-fns"
import subNetworkEmissions from "./subNetworkEmissions.json"
import { SubDao } from "./types"
Expand Down Expand Up @@ -61,13 +60,12 @@ export const getDailyEmisisons = (date: Date, token: Token) => {

// emissions schedule taken from https://github.com/helium/helium-program-library/tree/master/packages/helium-admin-cli/emissions
export const getLatestSubNetworkEmissions = (date: Date, token: SubDao) => {
const adjustedDate = sub(date, { days: 1 })
const emissions = subNetworkEmissions[token]
let currentEmissions = emissions[0].emissionsPerEpoch
let index = 1
while (
index < emissions.length &&
isAfter(adjustedDate, new Date(emissions[index].startTime))
isAfter(date, new Date(emissions[index].startTime))
) {
currentEmissions = emissions[index].emissionsPerEpoch
index++
Expand Down

0 comments on commit e0d268b

Please sign in to comment.