From 622007c3b0b8bd10a09c3f9d9f5be39a13557e20 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Mar 2024 19:53:05 +0900 Subject: [PATCH 1/2] Rearrange code for lodestar toolip --- src/pages/AdvancedFarm/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/AdvancedFarm/index.js b/src/pages/AdvancedFarm/index.js index 4991a051..877cd5e5 100644 --- a/src/pages/AdvancedFarm/index.js +++ b/src/pages/AdvancedFarm/index.js @@ -433,18 +433,18 @@ const AdvancedFarm = () => { ] // Show vault info badge when platform is 'Lodestar' and firstly view - const firstView = localStorage.getItem('firstView') useEffect(() => { const platform = useIFARM ? 'Harvest' : token.platform[0].toLowerCase() if (platform.includes('lodestar')) { setVaultInfoMessage(true) } + const firstView = localStorage.getItem('firstView') if (firstView === null || firstView === 'true') { localStorage.setItem('firstView', true) setFirstViewInfo(true) } - }, [token.platform, firstView, useIFARM]) + }, [token.platform, useIFARM]) const closeBadge = () => { setVaultInfoMessage(false) From 72ee6696651ea383a8282c8f6261cb3f8da4c9af Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 12 Mar 2024 16:51:09 +0900 Subject: [PATCH 2/2] Fixed the `Received` value issue when using default token on Convert/Revert --- .../Deposit/DepositStart/index.js | 21 ++++++++++--------- .../Withdraw/WithdrawStart/index.js | 10 +++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/AdvancedFarmComponents/Deposit/DepositStart/index.js b/src/components/AdvancedFarmComponents/Deposit/DepositStart/index.js index 16303c28..492bb9c9 100644 --- a/src/components/AdvancedFarmComponents/Deposit/DepositStart/index.js +++ b/src/components/AdvancedFarmComponents/Deposit/DepositStart/index.js @@ -67,10 +67,13 @@ const DepositStart = ({ const { fetchUserPoolStats, userStats } = usePools() const { getPortalsApproval, portalsApprove, getPortals } = usePortals() - const chainId = token.chain || token.data.chain + let pickedDefaultToken + if (pickedToken.symbol !== 'Select Token' && defaultToken) { + pickedDefaultToken = pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase() + } + const chainId = token.chain || token.data.chain const amount = toWei(inputAmount, pickedToken.decimals) - const toToken = token.vaultAddress || token.tokenAddress const [slippagePercentage, setSlippagePercentage] = useState(null) @@ -155,8 +158,6 @@ const DepositStart = ({ } const startDeposit = async () => { - const pickedDefaultToken = - pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase() if (progressStep === 0) { setStartSpinner(true) setProgressStep(1) @@ -401,7 +402,7 @@ const DepositStart = ({ )} - {progressStep === 4 ? ( + {!pickedDefaultToken && progressStep === 4 ? ( receiveAmount !== '' ? ( receiveAmount ) : ( @@ -419,16 +420,16 @@ const DepositStart = ({ {useIFARM ? `i${tokenSymbol}` : `f${tokenSymbol}`} - {progressStep === 4 ? ( + {!pickedDefaultToken && progressStep === 4 ? ( receiveUsd !== '' ? ( - <>≈ ${receiveUsd} + <>≈${receiveUsd} ) : ( - <>≈ $0 + <>≈$0 ) ) : minReceiveUsdAmount !== '' ? ( - <>≈ ${minReceiveUsdAmount} + <>≈${minReceiveUsdAmount} ) : ( - <>≈ $0 + <>≈$0 )} diff --git a/src/components/AdvancedFarmComponents/Withdraw/WithdrawStart/index.js b/src/components/AdvancedFarmComponents/Withdraw/WithdrawStart/index.js index 09621a64..29801848 100644 --- a/src/components/AdvancedFarmComponents/Withdraw/WithdrawStart/index.js +++ b/src/components/AdvancedFarmComponents/Withdraw/WithdrawStart/index.js @@ -81,6 +81,10 @@ const WithdrawStart = ({ const { getPortalsApproval, portalsApprove, getPortals } = usePortals() + let pickedDefaultToken + if (pickedToken.symbol !== 'Select' && defaultToken) { + pickedDefaultToken = pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase() + } const SlippageValues = [null, 0.1, 0.5, 1, 5] const onInputSlippage = e => { let inputValue = e.target.value @@ -118,8 +122,6 @@ const WithdrawStart = ({ } const startWithdraw = async () => { - const pickedDefaultToken = - pickedToken.address.toLowerCase() === defaultToken.address.toLowerCase() if (progressStep === 0) { setStartSpinner(true) setProgressStep(1) @@ -371,7 +373,7 @@ const WithdrawStart = ({ <> - {progressStep === 4 ? ( + {!pickedDefaultToken && progressStep === 4 ? ( revertedAmount !== '' ? ( revertedAmount ) : ( @@ -397,7 +399,7 @@ const WithdrawStart = ({ ) : ( )} */} - {progressStep === 4 ? ( + {!pickedDefaultToken && progressStep === 4 ? ( revertedAmountUsd === 'NaN' || revertedAmountUsd === '' ? ( '-' ) : revertedAmountUsd !== '' ? (