Skip to content

Commit

Permalink
Merge pull request #1823 from galacticcouncil/86c1102rd
Browse files Browse the repository at this point in the history
Fix decimals of min amount when removing liquidity from stablepool
  • Loading branch information
vkulinich-cl authored Nov 18, 2024
2 parents 0d4de87 + 9679b7c commit f391c20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const StablepoolPosition = ({ amount }: { amount: BN }) => {
{t("value.token", {
value: amount,
fixedPointScale: STABLEPOOL_TOKEN_DECIMALS,
numberSuffix: `${t(
numberSuffix: ` ${t(
"liquidity.stablepool.position.token",
)}`,
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Spacer } from "components/Spacer/Spacer"
import { Text } from "components/Typography/Text/Text"
import { useMemo } from "react"
import { Controller, useForm } from "react-hook-form"
import { Trans, useTranslation } from "react-i18next"
import { useTranslation } from "react-i18next"
import { useStore } from "state/store"
import { getFloatingPointAmount, normalizeBigNumber } from "utils/balance"
import {
Expand All @@ -20,6 +20,8 @@ import { STradingPairContainer } from "sections/pools/modals/RemoveLiquidity/Rem
import { RemoveLiquidityInput } from "sections/pools/modals/RemoveLiquidity/components/RemoveLiquidityInput"
import { useRpcProvider } from "providers/rpcProvider"
import { useAssets } from "providers/assets"
import { scale } from "utils/balance"
import { createToastMessages } from "state/toasts"

type RemoveLiquidityProps = {
assetId: string
Expand Down Expand Up @@ -86,7 +88,7 @@ export const RemoveStablepoolLiquidityForm = ({
position.poolId,
assetId,
removeSharesValue.dp(0).toString(),
minAmountOut.dp(0).toString(),
scale(minAmountOut, asset.decimals).dp(0).toString(),
),
},
{
Expand All @@ -97,38 +99,16 @@ export const RemoveStablepoolLiquidityForm = ({
onClose()
form.reset()
},
toast: {
onLoading: (
<Trans
t={t}
i18nKey="liquidity.stablepool.remove.onLoading"
tOptions={{
out: liquidityOut,
amount: removeSharesValue,
fixedPointScale: STABLEPOOL_TOKEN_DECIMALS,
symbol: asset?.symbol,
}}
>
<span />
<span className="highlight" />
</Trans>
),
onSuccess: (
<Trans
t={t}
i18nKey="liquidity.stablepool.remove.onSuccess"
tOptions={{
out: liquidityOut,
amount: removeSharesValue,
fixedPointScale: STABLEPOOL_TOKEN_DECIMALS,
symbol: asset?.symbol,
}}
>
<span />
<span className="highlight" />
</Trans>
),
},
toast: createToastMessages("liquidity.stablepool.remove", {
t,
tOptions: {
out: liquidityOut,
amount: removeSharesValue,
fixedPointScale: STABLEPOOL_TOKEN_DECIMALS,
symbol: asset?.symbol,
},
components: ["span", "span.highlight"],
}),
},
)
}
Expand Down

0 comments on commit f391c20

Please sign in to comment.