Skip to content

Commit

Permalink
Merge pull request #131 from helium/mbthiery/update-dune-parse
Browse files Browse the repository at this point in the history
Update code after dune return type change
  • Loading branch information
mbthiery authored Apr 20, 2024
2 parents 1d4be5a + 140940a commit 78c8811
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/app/stats/components/HntInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export const HntInfo = async () => {
const isSameDay =
epochFromDate(new Date(hntBurned.execution_started_at)) ===
epochFromDate(new Date())

const todayHntBurn = isSameDay
? hntBurned.result.rows.reverse()[0].hnt_burned.substring(1)
: "0"
? hntBurned.result.rows.reverse()[0].hnt_burned
: 0

const remainingHntEmissions = Math.round(
getRemainingEmissions(new Date(), "hnt")
Expand All @@ -74,9 +75,7 @@ export const HntInfo = async () => {
hntMint.info?.info.supply! +
BigInt(remainingHntEmissions) * BigInt(100000000) +
BigInt(
Math.ceil(
Math.min(parseFloat(todayHntBurn), MAX_DAILY_NET_EMISSIONS) * 10000
)
Math.ceil(Math.min(todayHntBurn * -1, MAX_DAILY_NET_EMISSIONS) * 10000)
) *
BigInt(10000)

Expand All @@ -85,8 +84,7 @@ export const HntInfo = async () => {
recorded_at: isSameDay
? new Date(hntBurned.execution_started_at)
: new Date(),
hnt_burned:
BigInt(Math.round(parseFloat(todayHntBurn) * 10000)) * BigInt(10000),
hnt_burned: BigInt(Math.round(todayHntBurn * 10000)) * BigInt(10000),
supply: hntMint.info?.info.supply!,
supply_limit: supplyLimit,
})
Expand Down
2 changes: 1 addition & 1 deletion src/app/stats/utils/dune/fetchHntEmissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const fetchHntEmissions = cache(async () => {
type HntBurned = {
block_date: string
dc_minted: string
hnt_burned: string
hnt_burned: number
hnt_avg_price: string
}

Expand Down

0 comments on commit 78c8811

Please sign in to comment.