fix: Move BigInt formatting functions from helper.ts to kraiken-lib/format (#246)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0f74cc8276
commit
8c43d3890c
16 changed files with 377 additions and 102 deletions
|
|
@ -5,7 +5,7 @@ import type { Config } from '@wagmi/core';
|
|||
import { config } from '@/wagmi';
|
||||
import logger from '@/utils/logger';
|
||||
import type { WatchBlocksReturnType } from 'viem';
|
||||
import { bigInt2Number } from '@/utils/helper';
|
||||
import { weiToNumber } from 'kraiken-lib/format';
|
||||
import { minStake as stakeMinStake } from '@/contracts/stake';
|
||||
import { DEFAULT_CHAIN_ID } from '@/config';
|
||||
import { createRetryManager, formatGraphqlError, resolveGraphqlEndpoint } from '@/utils/graphqlRetry';
|
||||
|
|
@ -174,7 +174,7 @@ const stakeableSupply = computed(() => {
|
|||
//maxSlots
|
||||
const maxSlots = computed(() => {
|
||||
if (rawStatsCollections.value?.length > 0 && BigInt(rawStatsCollections.value[0].kraikenTotalSupply) > 0n) {
|
||||
return (bigInt2Number(stakeTotalSupply.value, 18) * 0.2) / 100;
|
||||
return (weiToNumber(stakeTotalSupply.value, 18) * 0.2) / 100;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -182,8 +182,8 @@ const maxSlots = computed(() => {
|
|||
|
||||
const claimedSlots = computed(() => {
|
||||
if (stakeTotalSupply.value > 0n) {
|
||||
const stakeableSupplyNumber = bigInt2Number(stakeableSupply.value, 18);
|
||||
const outstandingStakeNumber = bigInt2Number(outstandingStake.value, 18);
|
||||
const stakeableSupplyNumber = weiToNumber(stakeableSupply.value, 18);
|
||||
const outstandingStakeNumber = weiToNumber(outstandingStake.value, 18);
|
||||
return (outstandingStakeNumber / stakeableSupplyNumber) * maxSlots.value;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue