Skip to content

Commit

Permalink
Prefer hnt naming convention over bones.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewcarlreetz committed Apr 10, 2024
1 parent f3735ce commit 549db22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/onboarding/src/HotspotOnboardingUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@helium/helium-entity-manager-sdk'
import * as Currency from '@helium/currency-utils'
import {
BONES_IN_HNT,
HNT_AS_BONES,
DcProgram,
DeviceType,
HemProgram,
Expand Down Expand Up @@ -173,10 +173,10 @@ const getBalance = async (wallet: PublicKey, connection: Connection, mint: Publi

const getBalances = async (wallet: PublicKey, connection: Connection) => {
const lamports = await connection.getBalance(wallet)
const bones = await getBalance(wallet, connection, HNT_MINT)
const hnt = await getBalance(wallet, connection, HNT_MINT)
const dc = await getBalance(wallet, connection, DC_MINT)

return { bones, dc, lamports: new BN(lamports) }
return { hnt, dc, lamports: new BN(lamports) }
}

const burnHNTForDataCredits = async ({
Expand Down Expand Up @@ -330,8 +330,8 @@ export const getAssertData = async ({

const dcInCents = dcNeeded.div(new BN(100000)).mul(new BN(100))
const oraclePriceInCents = await getOraclePriceInCentsFromSolana({ connection, cluster })
const bonesNeeded = dcInCents.mul(BONES_IN_HNT).divRound(oraclePriceInCents)
hasSufficientHnt = balances.bones.gte(bonesNeeded)
const hntNeeded = dcInCents.mul(HNT_AS_BONES).divRound(oraclePriceInCents)
hasSufficientHnt = balances.hnt.gte(hntNeeded)

if (hasSufficientHnt) {
const txn = await burnHNTForDataCredits({
Expand Down
2 changes: 1 addition & 1 deletion packages/onboarding/src/__mocks__/AssertMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AssertData } from '../types'
export const getAssertData = async (): Promise<AssertData> => {
return {
balances: {
bones: new BN(100000000000),
hnt: new BN(100000000000),
dc: new BN(1000000000),
lamports: new BN(1000000000000),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/onboarding/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export type HeightType = 'MSL' | 'AGL' | 'NONE' | 'UNRECOGNIZED'
export type NetworkType = 'IOT' | 'MOBILE'
export type DeviceType = 'Cbrs' | 'WifiIndoor' | 'WifiOutdoor' | null // null is for IOT devices

export const BONES_IN_HNT = new BN(100000000)
export const HNT_AS_BONES = new BN(100000000)
export const TXN_FEE_IN_LAMPORTS = new BN(5000)

export type HemProgram = Awaited<ReturnType<typeof initHem>>
Expand Down

0 comments on commit 549db22

Please sign in to comment.