align values for the bond discout object

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-05-07 17:29:32 +03:00
parent a52372dbe5
commit fb0f39e3e6
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
3 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "ghost-dao-interface", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.0.25", "version": "0.0.26",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -5,7 +5,7 @@ import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber";
const BondDiscount = ({ discount, textOnly }) => { const BondDiscount = ({ discount, textOnly }) => {
const theme = useTheme(); const theme = useTheme();
const discountString = `${formatNumber(Number(discount.mul(new DecimalBigNumber("100").toString())), 2)}%`; const discountString = `${formatNumber(Number(discount.mul(new DecimalBigNumber("100")).toString()), 2)}%`;
return textOnly ? ( return textOnly ? (
<Box <Box
@ -17,7 +17,7 @@ const BondDiscount = ({ discount, textOnly }) => {
</Box> </Box>
) : ( ) : (
<Chip <Chip
label={`${formatNumber(Number(discount.mul(new DecimalBigNumber("100")).toString()), 2)}%`} label={discountString}
template={new DecimalBigNumber("0").gt(discount) ? "error" : "success"} template={new DecimalBigNumber("0").gt(discount) ? "error" : "success"}
/> />
); );

View File

@ -102,7 +102,7 @@ export const useLiveBonds = (chainId) => {
const priceInUsd = quoteTokenPerUsd.mul(quoteTokenPerBaseToken); const priceInUsd = quoteTokenPerUsd.mul(quoteTokenPerBaseToken);
const discount = quoteTokenPerUsd._value > 0n const discount = quoteTokenPerUsd._value > 0n
? quoteTokenPerUsd.sub(priceInUsd).div(quoteTokenPerUsd) ? quoteTokenPerUsd.sub(priceInUsd).div(quoteTokenPerUsd)
: quoteTokenPerUsd; : new DecimalBigNumber("0", quoteTokenDecimals);
const capacityInBaseToken = capacityInQuote const capacityInBaseToken = capacityInQuote
? new DecimalBigNumber(marketPrice > 0n ? marketCapacity / marketPrice : 0n, 9) ? new DecimalBigNumber(marketPrice > 0n ? marketCapacity / marketPrice : 0n, 9)