-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix ordering of PieBar * fix decimal places of stakingAmount in StakingModal, so all balance-input comparisons work * fixed border of PieBar if no tokens staked * fix order of PieBar
- Loading branch information
1 parent
62d2721
commit b86857f
Showing
4 changed files
with
31 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
type PercentObject = { | ||
unstakablePercent: number; | ||
stakedPercent: number; | ||
stakablePercent: number; | ||
unstakedPercent: number; | ||
}; | ||
|
||
export const calculateTokenProportions = ({ | ||
unstakable, | ||
staked, | ||
stakable, | ||
unstaked, | ||
}: { | ||
unstakable: number; | ||
staked: number; | ||
stakable: number; | ||
unstaked: number; | ||
}): PercentObject => { | ||
const totalBalance = unstakable + staked + stakable; | ||
const totalBalance = unstakable + staked + unstaked; | ||
|
||
if (totalBalance === 0) { | ||
return { | ||
unstakablePercent: 0, | ||
stakedPercent: 0, | ||
stakablePercent: 0, | ||
unstakedPercent: 0, | ||
}; | ||
} | ||
|
||
return { | ||
unstakablePercent: (unstakable / totalBalance) * 100, | ||
stakedPercent: (staked / totalBalance) * 100, | ||
stakablePercent: (stakable / totalBalance) * 100, | ||
unstakedPercent: (unstaked / totalBalance) * 100, | ||
}; | ||
}; |