Skip to content

Commit

Permalink
fix: incorrect BN parsing causing wrong stake readings
Browse files Browse the repository at this point in the history
  • Loading branch information
kgmyatthu committed Jul 1, 2024
1 parent f006cd2 commit 62de2e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/class/StatsFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const recordCoinStats = async (latestCycle: number, lastStoredCycle: numb
'readableReceipt' in current.wrappedEVMAccount &&
current.wrappedEVMAccount.readableReceipt?.stakeInfo?.stake
) {
const stakeAmountBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.stake, 16)
const stakeAmountBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.stake.toString())
return sum.add(stakeAmountBN)
} else {
return sum
Expand All @@ -223,7 +223,7 @@ export const recordCoinStats = async (latestCycle: number, lastStoredCycle: numb
'readableReceipt' in current.wrappedEVMAccount &&
current.wrappedEVMAccount.readableReceipt?.stakeInfo?.stake
) {
const unStakeAmountBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.stake, 16)
const unStakeAmountBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.stake.toString())
return sum.add(unStakeAmountBN)
} else {
return sum
Expand All @@ -235,7 +235,7 @@ export const recordCoinStats = async (latestCycle: number, lastStoredCycle: numb
'readableReceipt' in current.wrappedEVMAccount &&
current.wrappedEVMAccount.readableReceipt?.stakeInfo?.reward
) {
const rewardBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.reward, 16)
const rewardBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.reward.toString())
return sum.add(rewardBN)
} else {
return sum
Expand All @@ -247,7 +247,7 @@ export const recordCoinStats = async (latestCycle: number, lastStoredCycle: numb
'readableReceipt' in current.wrappedEVMAccount &&
current.wrappedEVMAccount.readableReceipt?.stakeInfo?.penalty
) {
const penaltyBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.penalty, 16)
const penaltyBN = new BN(current.wrappedEVMAccount.readableReceipt.stakeInfo.penalty.toString())
return sum.add(penaltyBN)
} else {
return sum
Expand Down

0 comments on commit 62de2e6

Please sign in to comment.