Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1961 from gnosis/aba-fix-labels
Browse files Browse the repository at this point in the history
[ABA - fixes] - Fix warning showing when not needed, and show correct impact in modal
  • Loading branch information
W3stside authored Dec 3, 2021
2 parents 0bfda08 + b722bf2 commit f1afffe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
10 changes: 3 additions & 7 deletions src/custom/components/SwapWarnings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,11 @@ const HighFeeWarningMessage = ({ feePercentage }: { feePercentage?: Fraction })
const NoImpactWarningMessage = (
<div>
<small>
We are unfortunately unable to calculate any price impact for this order.
We are unable to calculate the price impact for this order.
<br />
<br />
<u>
<strong>We strongly advise you to do your due diligence before advancing.</strong>
</u>
<br />
<br />
You may still move forward with this order but make sure the receive amounts are what you expect.
You may still move forward but{' '}
<strong>please review carefully that the receive amounts are what you expect.</strong>
</small>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function ConfirmSwapModal({
onConfirm,
onDismiss,
recipient,
priceImpact,
swapErrorMessage,
isOpen,
attemptingTxn,
Expand All @@ -59,6 +60,7 @@ export default function ConfirmSwapModal({
attemptingTxn: boolean
txHash: string | undefined
recipient: string | null
priceImpact?: Percent
allowedSlippage: Percent
onAcceptChanges: () => void
onConfirm: () => void
Expand Down Expand Up @@ -89,12 +91,13 @@ export default function ConfirmSwapModal({
trade={trade}
allowsOffchainSigning={allowsOffchainSigning}
allowedSlippage={allowedSlippage}
priceImpact={priceImpact}
recipient={recipient}
showAcceptChanges={showAcceptChanges}
onAcceptChanges={onAcceptChanges}
/>
) : null
}, [allowedSlippage, onAcceptChanges, recipient, showAcceptChanges, trade, allowsOffchainSigning])
}, [trade, allowsOffchainSigning, allowedSlippage, priceImpact, recipient, showAcceptChanges, onAcceptChanges])

const modalBottom = useCallback(() => {
return trade ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useHigherUSDValue /* , useUSDCValue */ } from 'hooks/useUSDCPrice'
import { TYPE } from 'theme'
import { ButtonPrimary } from 'components/Button'
import { isAddress, shortenAddress } from 'utils'
import { computeFiatValuePriceImpact } from 'utils/computeFiatValuePriceImpact'
// import { computeFiatValuePriceImpact } from 'utils/computeFiatValuePriceImpact'
import { AutoColumn } from 'components/Column'
import { FiatValue } from 'components/CurrencyInputPanel/FiatValue'
import CurrencyLogo from 'components/CurrencyLogo'
Expand Down Expand Up @@ -60,6 +60,7 @@ export interface SwapModalHeaderProps {
recipient: string | null
showAcceptChanges: boolean
priceImpactWithoutFee?: Percent
priceImpact?: Percent
onAcceptChanges: () => void
LightCard: LightCardType
HighFeeWarning: React.FC<WarningProps>
Expand All @@ -72,6 +73,7 @@ export default function SwapModalHeader({
allowedSlippage,
recipient,
showAcceptChanges,
priceImpact,
onAcceptChanges,
LightCard,
HighFeeWarning,
Expand Down Expand Up @@ -176,10 +178,7 @@ SwapModalHeaderProps) {
<Trans>To</Trans>
</TYPE.body>
<TYPE.body fontSize={14} color={theme.text3}>
<FiatValue
fiatValue={fiatValueOutput}
priceImpact={computeFiatValuePriceImpact(fiatValueInput, fiatValueOutput)}
/>
<FiatValue fiatValue={fiatValueOutput} priceImpact={priceImpact} />
</TYPE.body>
</RowBetween>
<RowBetween align="flex-end">
Expand Down Expand Up @@ -293,7 +292,7 @@ SwapModalHeaderProps) {
{/* High Fee Warning */}
<HighFeeWarning trade={trade} />
{/* No Impact Warning */}
<NoImpactWarning margin="0" />
{!priceImpact && <NoImpactWarning margin="0" />}
</AutoColumn>
)
}
1 change: 1 addition & 0 deletions src/custom/pages/Swap/SwapMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ export default function Swap({
txHash={txHash}
recipient={recipient}
allowedSlippage={allowedSlippage}
priceImpact={priceImpact}
onConfirm={handleSwap}
swapErrorMessage={swapErrorMessage}
onDismiss={handleConfirmDismiss}
Expand Down

0 comments on commit f1afffe

Please sign in to comment.