Skip to content

Commit

Permalink
refactor: revert actual apr
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Aug 28, 2024
1 parent f877596 commit fd5ecbc
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions layer/store/param.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
Pool,
MinModuleParams as MintModuleParams
} from '@injectivelabs/sdk-ts'
import { HttpClient, BigNumberInBase } from '@injectivelabs/utils'
import { BigNumberInBase } from '@injectivelabs/utils'
import { injToken } from './../data/token'
import { mintApi, bankApi, stakingApi } from './../Service'
import { sharedToBalanceInToken } from './../utils/formatter'

const ACTUAL_BLCOk_TIME = 0.625194000005722
const ACTUAL_BLOCKS_PER_YEAR = 50441942.82048672
const ACTUAL_BLOCK_TIME = 0.75
const ACTUAL_BLOCKS_PER_YEAR = 42_048_000

type ParamStoreState = {
injSupply: string
Expand Down Expand Up @@ -100,31 +100,10 @@ export const useSharedParamStore = defineStore('sharedParam', {
async fetchChainParams() {
const paramStore = useSharedParamStore()

const httpClient = new HttpClient('https://chains.cosmos.directory/')

try {
const { data } = (await httpClient.get('injective')) as {
data: {
chain: {
params: {
actual_block_time: number
actual_blocks_per_year: number
}
}
}
}

paramStore.$patch({
actualBlockTime: data.chain.params.actual_block_time,
actualBlocksPerYear: data.chain.params.actual_blocks_per_year
})
} catch (error: any) {
// silently throw
paramStore.$patch({
actualBlockTime: ACTUAL_BLCOk_TIME,
actualBlocksPerYear: ACTUAL_BLOCKS_PER_YEAR
})
}
paramStore.$patch({
actualBlockTime: ACTUAL_BLOCK_TIME,
actualBlocksPerYear: ACTUAL_BLOCKS_PER_YEAR
})
}
}
})

0 comments on commit fd5ecbc

Please sign in to comment.