From 880113c9144a27417569f51e2b91ecfa4e33ee28 Mon Sep 17 00:00:00 2001 From: Apotheosis <0xapotheosis@gmail.com> Date: Fri, 19 Jul 2024 03:52:58 +1000 Subject: [PATCH] chore: re-enable lifi swapper (#7385) --- .env.app | 1 - .env.base | 2 +- .env.private | 1 - .../MultiHopTradeConfirm/components/ApprovalStep.tsx | 11 +++++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.env.app b/.env.app index 4f11b9c07c4..6278402e348 100644 --- a/.env.app +++ b/.env.app @@ -1,6 +1,5 @@ # feature flags REACT_APP_FEATURE_CHATWOOT=true -REACT_APP_FEATURE_LIFI_SWAP=false # mixpanel REACT_APP_MIXPANEL_TOKEN=9d304465fc72224aead9e027e7c24356 diff --git a/.env.base b/.env.base index b6b9b6bb481..cc1d693df3f 100644 --- a/.env.base +++ b/.env.base @@ -53,7 +53,7 @@ REACT_APP_FEATURE_READ_ONLY_ASSETS=true REACT_APP_FEATURE_COWSWAP=true REACT_APP_FEATURE_COWSWAP_GNOSIS=true REACT_APP_FEATURE_COWSWAP_ARBITRUM=false -REACT_APP_FEATURE_LIFI_SWAP=false +REACT_APP_FEATURE_LIFI_SWAP=true REACT_APP_FEATURE_ONE_INCH=false REACT_APP_FEATURE_THOR_SWAP=true REACT_APP_FEATURE_THOR_SWAP_STREAMING_SWAPS=true diff --git a/.env.private b/.env.private index 8bdc030edba..ce442e1f770 100644 --- a/.env.private +++ b/.env.private @@ -1,7 +1,6 @@ # feature flags REACT_APP_FEATURE_MIXPANEL=false REACT_APP_FEATURE_CHATWOOT=false -REACT_APP_FEATURE_LIFI_SWAP=false # unchained REACT_APP_UNCHAINED_ETHEREUM_HTTP_URL=https://api.ethereum.shapeshift.com diff --git a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx index a9eef6f26af..e1cff6b76fb 100644 --- a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx +++ b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx @@ -1,5 +1,6 @@ import { Box, Button, Card, Icon, Link, Switch, Tooltip, VStack } from '@chakra-ui/react' import type { TradeQuoteStep } from '@shapeshiftoss/swapper' +import { SwapperName } from '@shapeshiftoss/swapper' import { useCallback, useMemo } from 'react' import { FaInfoCircle } from 'react-icons/fa' import { useTranslate } from 'react-polyglot' @@ -76,7 +77,12 @@ const ApprovalStepPending = ({ number: { toCrypto }, } = useLocaleFormatter() - const [isExactAllowance, toggleIsExactAllowance] = useToggle(false) + const isLifiStep = useMemo(() => { + return tradeQuoteStep.source.startsWith(SwapperName.LIFI) + }, [tradeQuoteStep.source]) + + // Default to exact allowance for LiFi due to contract vulnerabilities + const [isExactAllowance, toggleIsExactAllowance] = useToggle(isLifiStep ? true : false) const { state, @@ -163,7 +169,7 @@ const ApprovalStepPending = ({ size='sm' mx={2} isChecked={isExactAllowance} - disabled={!canAttemptApproval} + disabled={!canAttemptApproval || isLifiStep} onChange={toggleIsExactAllowance} />