Skip to content

Commit

Permalink
display dust fee correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight committed Nov 21, 2024
1 parent fbc7fc4 commit 966ef7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,11 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
}, [onNext])

const missingBalanceForGasCryptoPrecision = useMemo(() => {
// Token withdraws aren't dust sends, they're actual contract calls
// Hence, the balance required for them is denominated in the native fee asset
if (isTokenWithdraw) {
return fromBaseUnit(
bnOrZero(feeAssetBalanceCryptoBaseUnit)
.minus(bnOrZero(state?.withdraw.estimatedGasCryptoBaseUnit))
.minus(bnOrZero(dustAmountCryptoBaseUnit))
.times(-1),
feeAsset.precision,
)
Expand Down Expand Up @@ -597,7 +596,7 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
</Box>
</Row.Value>
</Row>
{!isTokenWithdraw && !isRunePool && (
{!isRunePool && (
<Row variant='gutter'>
<Row.Label>
<HelperTooltip label={translate('defi.modals.saversVaults.dustAmountTooltip')}>
Expand All @@ -609,14 +608,14 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
<Skeleton isLoaded={!quoteLoading}>
<Amount.Fiat
fontWeight='bold'
value={bn(fromBaseUnit(dustAmountCryptoBaseUnit, asset.precision))
.times(marketData.price)
value={bn(fromBaseUnit(dustAmountCryptoBaseUnit, feeAsset.precision))
.times(feeMarketData.price)
.toFixed(2)}
/>
<Amount.Crypto
color='text.subtle'
value={fromBaseUnit(dustAmountCryptoBaseUnit, asset.precision)}
symbol={asset.symbol}
value={fromBaseUnit(dustAmountCryptoBaseUnit, feeAsset.precision)}
symbol={feeAsset.symbol}
/>
</Skeleton>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,16 @@ export const Status: React.FC<StatusProps> = ({ accountId }) => {
<Amount.Fiat
fontWeight='bold'
value={bnOrZero(state.withdraw.dustAmountCryptoBaseUnit)
.div(bn(10).pow(asset.precision))
.times(marketData.price)
.div(bn(10).pow(feeAsset.precision))
.times(feeMarketData.price)
.toFixed()}
/>
<Amount.Crypto
color='text.subtle'
value={bnOrZero(state.withdraw.dustAmountCryptoBaseUnit)
.div(bn(10).pow(asset.precision))
.div(bn(10).pow(feeAsset.precision))
.toFixed()}
symbol={asset.symbol}
symbol={feeAsset.symbol}
/>
</Box>
</Row.Value>
Expand Down

0 comments on commit 966ef7b

Please sign in to comment.