From 21cd0bcd0d781d0262c23153f04a91d02992d3f2 Mon Sep 17 00:00:00 2001 From: Majorfi Date: Mon, 15 Jan 2024 10:53:37 +0100 Subject: [PATCH] fix: v3 deposit vanilla --- CHANGELOG.md | 1 + .../details/actions/QuickActionsButtons.tsx | 57 ------------------- apps/vaults/contexts/useActionFlow.tsx | 10 ++-- apps/vaults/contexts/useSolver.tsx | 1 - 4 files changed, 7 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb67ad28..6615dd432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 0.3.7 +- Fix: Disable the partnerContract for V3 vaults deposits. (15/01/2024) - Feat: Add info tab in the vault details page. (11/01/2024) - Fix: APR display on details for V3. (04/01/2024) - Feat: Adding boosted property handling. (04/01/2024) diff --git a/apps/vaults-v3/components/details/actions/QuickActionsButtons.tsx b/apps/vaults-v3/components/details/actions/QuickActionsButtons.tsx index ed9d570b1..7f2edcb26 100644 --- a/apps/vaults-v3/components/details/actions/QuickActionsButtons.tsx +++ b/apps/vaults-v3/components/details/actions/QuickActionsButtons.tsx @@ -6,11 +6,9 @@ import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3'; import {toAddress} from '@yearn-finance/web-lib/utils/address'; import {ETH_TOKEN_ADDRESS, MAX_UINT_256} from '@yearn-finance/web-lib/utils/constants'; import {toBigInt, toNormalizedBN} from '@yearn-finance/web-lib/utils/format.bigNumber'; -import {isEth} from '@yearn-finance/web-lib/utils/isEth'; import {isZero} from '@yearn-finance/web-lib/utils/isZero'; import {defaultTxStatus} from '@yearn-finance/web-lib/utils/web3/transaction'; import {useWallet} from '@common/contexts/useWallet'; -import {useYearn} from '@common/contexts/useYearn'; import {useAsyncTrigger} from '@common/hooks/useAsyncEffect'; import {Solver} from '@common/schemas/yDaemonTokenListBalances'; @@ -21,7 +19,6 @@ import type {TYDaemonVault} from '@common/schemas/yDaemonVaultsSchemas'; export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: TYDaemonVault}): ReactElement { const {refresh} = useWallet(); const {address, provider} = useWeb3(); - const {isStakingOpBoostedVaults} = useYearn(); const [txStatusApprove, set_txStatusApprove] = useState(defaultTxStatus); const [txStatusExecuteDeposit, set_txStatusExecuteDeposit] = useState(defaultTxStatus); const [txStatusExecuteWithdraw, set_txStatusExecuteWithdraw] = useState(defaultTxStatus); @@ -37,7 +34,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T isLoadingExpectedOut, hash } = useSolver(); - const isWithdrawing = !isDepositing; /* 🔵 - Yearn Finance ************************************************************************** ** SWR hook to get the expected out for a given in/out pair with a specific amount. This hook is @@ -114,43 +110,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T ** Wrapper to decide if we should use the partner contract or not **************************************************************************/ const isAboveAllowance = toBigInt(actionParams.amount.raw) > toBigInt(allowanceFrom?.raw); - - if ( - isWithdrawing && //If user is withdrawing ... - currentSolver === Solver.enum.ChainCoin && // ... and the solver is ChainCoin ... - isEth(actionParams?.selectedOptionTo?.value) && // ... and the output is ETH ... - isAboveAllowance // ... and the amount is above the allowance - ) { - // ... then we need to approve the ChainCoin contract - return ( - - ); - } - - if ( - isDepositing && //If user is depositing ... - currentSolver === Solver.enum.ChainCoin // ... and the solver is ChainCoin ... - ) { - // ... then we can deposit without approval - return ( - - ); - } - if ( (txStatusApprove.pending || isAboveAllowance) && //If the button is busy or the amount is above the allowance ... ((isDepositing && currentSolver === Solver.enum.Vanilla) || // ... and the user is depositing with Vanilla ... @@ -173,22 +132,6 @@ export function VaultDetailsQuickActionsButtons({currentVault}: {currentVault: T } if (isDepositing || currentSolver === Solver.enum.InternalMigration) { - if (currentSolver === Solver.enum.OptimismBooster && isStakingOpBoostedVaults) { - return ( - - ); - } return (