From f65e0a8f142303ce72dc588e3942d3ad15fb8772 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Thu, 27 Nov 2025 20:00:13 +0100 Subject: [PATCH 1/3] feat: halt thorchain lp deposit/withdraw --- .env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 0ca8b531a46..b7502369f12 100644 --- a/.env +++ b/.env @@ -27,8 +27,8 @@ VITE_FEATURE_THORCHAIN_LENDING_REPAY=false VITE_FEATURE_THORCHAINSWAP_LONGTAIL=true VITE_FEATURE_THORCHAINSWAP_L1_TO_LONGTAIL=true VITE_FEATURE_THORCHAIN_LP=true -VITE_FEATURE_THORCHAIN_LP_DEPOSIT=true -VITE_FEATURE_THORCHAIN_LP_WITHDRAW=true +VITE_FEATURE_THORCHAIN_LP_DEPOSIT=false +VITE_FEATURE_THORCHAIN_LP_WITHDRAW=false VITE_FEATURE_RFOX=true VITE_FEATURE_RFOX_LP=true VITE_FEATURE_ARBITRUM_BRIDGE=true From dc345cc967cf312701d221813cc780f1e09fe4f2 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Thu, 27 Nov 2025 20:05:16 +0100 Subject: [PATCH 2/3] Revert "feat: halt thorchain lp deposit/withdraw" This reverts commit f65e0a8f142303ce72dc588e3942d3ad15fb8772. --- .env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index b7502369f12..0ca8b531a46 100644 --- a/.env +++ b/.env @@ -27,8 +27,8 @@ VITE_FEATURE_THORCHAIN_LENDING_REPAY=false VITE_FEATURE_THORCHAINSWAP_LONGTAIL=true VITE_FEATURE_THORCHAINSWAP_L1_TO_LONGTAIL=true VITE_FEATURE_THORCHAIN_LP=true -VITE_FEATURE_THORCHAIN_LP_DEPOSIT=false -VITE_FEATURE_THORCHAIN_LP_WITHDRAW=false +VITE_FEATURE_THORCHAIN_LP_DEPOSIT=true +VITE_FEATURE_THORCHAIN_LP_WITHDRAW=true VITE_FEATURE_RFOX=true VITE_FEATURE_RFOX_LP=true VITE_FEATURE_ARBITRUM_BRIDGE=true From b0e4865f6bf83bce9d1108b7c9fd3722be9b8e59 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Thu, 27 Nov 2025 20:20:30 +0100 Subject: [PATCH 3/3] feat: check PAUSELP mimir for THORChain LP deposit/withdraw operations --- .../hooks/useIsThorchainLpDepositEnabled.tsx | 24 +++++++++++++++++++ src/pages/ThorChainLP/AvailablePools.tsx | 11 ++++++--- .../AddLiquidity/AddLiquidityInput.tsx | 11 ++++----- .../RemoveLiquidity/RemoveLiquidityInput.tsx | 10 +++++--- .../ThorChainLP/queries/hooks/usePool.ts | 1 + .../ThorChainLP/queries/hooks/usePools.ts | 11 +++++++-- 6 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx b/src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx index 92e64c53da9..c337db13b8a 100644 --- a/src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx +++ b/src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx @@ -14,6 +14,8 @@ export const isLpDepositEnabled = ({ }) => { if (!assetId) return undefined + if (mimir.PAUSELP) return false + const pauseLpDepositMimirs = Object.fromEntries( Object.entries(mimir).filter(([k]) => k.startsWith('PAUSELPDEPOSIT-')), ) @@ -31,6 +33,20 @@ export const isLpDepositEnabled = ({ return !isDisabled } +export const isLpWithdrawEnabled = ({ + mimir, + assetId, +}: { + mimir: ThorchainMimir + assetId: AssetId | undefined +}) => { + if (!assetId) return undefined + + if (mimir.PAUSELP) return false + + return true +} + export const useIsLpDepositEnabled = (assetId: AssetId | undefined) => { return useThorchainMimir({ chainId: thorchainChainId, @@ -38,3 +54,11 @@ export const useIsLpDepositEnabled = (assetId: AssetId | undefined) => { select: mimir => isLpDepositEnabled({ mimir, assetId }), }) } + +export const useIsLpWithdrawEnabled = (assetId: AssetId | undefined) => { + return useThorchainMimir({ + chainId: thorchainChainId, + enabled: Boolean(assetId), + select: mimir => isLpWithdrawEnabled({ mimir, assetId }), + }) +} diff --git a/src/pages/ThorChainLP/AvailablePools.tsx b/src/pages/ThorChainLP/AvailablePools.tsx index e0dbfa55600..01da5b64b8e 100644 --- a/src/pages/ThorChainLP/AvailablePools.tsx +++ b/src/pages/ThorChainLP/AvailablePools.tsx @@ -47,6 +47,9 @@ export const AvailablePools = () => { const { data: pools } = usePools() const translate = useTranslate() + const isThorchainLpDepositFlagEnabled = useFeatureFlag('ThorchainLpDeposit') + const isThorchainLpWithdrawFlagEnabled = useFeatureFlag('ThorchainLpWithdraw') + const headerComponent = useMemo(() => , []) // Partition pools by *akschually* available (not halted, staged, nor deposits disabled) and the rest @@ -81,8 +84,10 @@ export const AvailablePools = () => { Cell: ({ row, value }: { value: string; row: RowProps }) => { const pool = row.original - const isThorchainLpDepositEnabled = useFeatureFlag('ThorchainLpDeposit') - const isThorchainLpWithdrawEnabled = useFeatureFlag('ThorchainLpWithdraw') + const isThorchainLpDepositEnabled = + isThorchainLpDepositFlagEnabled && pool.isLpDepositEnabled !== false + const isThorchainLpWithdrawEnabled = + isThorchainLpWithdrawFlagEnabled && pool.isLpWithdrawEnabled !== false const isThorchainLpInteractionDisabled = !isThorchainLpDepositEnabled && !isThorchainLpWithdrawEnabled @@ -186,7 +191,7 @@ export const AvailablePools = () => { }, }, ], - [translate], + [translate, isThorchainLpDepositFlagEnabled, isThorchainLpWithdrawFlagEnabled], ) const handlePoolClick = useCallback( diff --git a/src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx b/src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx index 935cb449c8f..31b7950b8be 100644 --- a/src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx +++ b/src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx @@ -538,7 +538,10 @@ export const AddLiquidityInput: React.FC = ({ }) }, [poolAsset]) + const isThorchainLpDepositFlagEnabled = useFeatureFlag('ThorchainLpDeposit') const { data: isThorchainLpDepositEnabledForPool } = useIsLpDepositEnabled(poolAsset?.assetId) + const isThorchainLpDepositEnabled = + isThorchainLpDepositFlagEnabled && isThorchainLpDepositEnabledForPool !== false const feeEstimationMemo = useMemo(() => { if (thorchainNotationPoolAssetId === undefined) return null @@ -613,8 +616,6 @@ export const AddLiquidityInput: React.FC = ({ const { isChainHalted, isFetching: isChainHaltedFetching } = useIsChainHalted(poolAsset?.chainId) - const isThorchainLpDepositFlagEnabled = useFeatureFlag('ThorchainLpDeposit') - const serializedApprovalTxIndex = useMemo(() => { if (!(approvalTxId && poolAssetAccountAddress && poolAssetAccountId)) return '' return serializeTxIndex(poolAssetAccountId, approvalTxId, poolAssetAccountAddress) @@ -1044,7 +1045,6 @@ export const AddLiquidityInput: React.FC = ({ actualRuneDepositAmountCryptoPrecision, poolAsset, runeMarketData, - isThorchainLpDepositFlagEnabled, ]) useEffect(() => { @@ -1463,6 +1463,7 @@ export const AddLiquidityInput: React.FC = ({ isConnected, isSmartContractAccountAddress, isThorchainLpDepositFlagEnabled, + isThorchainLpDepositEnabledForPool, isTradingActive, isChainHalted, notEnoughFeeAssetError, @@ -1474,7 +1475,6 @@ export const AddLiquidityInput: React.FC = ({ runeAsset, translate, walletSupportsOpportunity, - isThorchainLpDepositEnabledForPool, isStagedAsymDeposit, ]) @@ -1660,8 +1660,7 @@ export const AddLiquidityInput: React.FC = ({ disabledSymDepositAfterRune || isTradingActive === false || isChainHalted || - !isThorchainLpDepositFlagEnabled || - isThorchainLpDepositEnabledForPool === false || + !isThorchainLpDepositEnabled || !confirmedQuote || !hasEnoughAssetBalance || !hasEnoughRuneBalance || diff --git a/src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx b/src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx index d9b250f8cc3..3391cde709a 100644 --- a/src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx +++ b/src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx @@ -54,6 +54,7 @@ import { assertUnreachable } from '@/lib/utils' import { fromThorBaseUnit, getThorchainFromAddress } from '@/lib/utils/thorchain' import { THOR_PRECISION } from '@/lib/utils/thorchain/constants' import { useIsChainHalted } from '@/lib/utils/thorchain/hooks/useIsChainHalted' +import { useIsLpWithdrawEnabled } from '@/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled' import { useSendThorTx } from '@/lib/utils/thorchain/hooks/useSendThorTx' import { estimateRemoveThorchainLiquidityPosition } from '@/lib/utils/thorchain/lp' import type { LpConfirmedWithdrawalQuote, UserLpDataPosition } from '@/lib/utils/thorchain/lp/types' @@ -190,7 +191,8 @@ export const RemoveLiquidityInput: React.FC = ({ fromAssetId(assetId).chainId, ) - const isThorchainLpWithdrawEnabled = useFeatureFlag('ThorchainLpWithdraw') + const isThorchainLpWithdrawFlagEnabled = useFeatureFlag('ThorchainLpWithdraw') + const { data: isThorchainLpWithdrawEnabledForPool } = useIsLpWithdrawEnabled(poolAsset?.assetId) const currentAccountIdByChainId = useMemo(() => { if (!poolAsset) return {} @@ -965,7 +967,8 @@ export const RemoveLiquidityInput: React.FC = ({ if (isUnsupportedWithdraw) return translate('common.unsupportedNetwork') if (isChainHalted) return translate('common.chainHalted') if (isTradingActive === false) return translate('common.poolHalted') - if (!isThorchainLpWithdrawEnabled) return translate('common.poolDisabled') + if (!isThorchainLpWithdrawFlagEnabled) return translate('common.poolDisabled') + if (isThorchainLpWithdrawEnabledForPool === false) return translate('common.poolDisabled') if (position?.remainingLockupTime) return translate('defi.liquidityLocked', { time: formatSecondsToDuration(position.remainingLockupTime), @@ -983,7 +986,8 @@ export const RemoveLiquidityInput: React.FC = ({ }, [ hasEnoughPoolAssetFeeAssetBalanceForTx, hasEnoughRuneBalanceForTx, - isThorchainLpWithdrawEnabled, + isThorchainLpWithdrawFlagEnabled, + isThorchainLpWithdrawEnabledForPool, isTradingActive, isChainHalted, isUnsupportedWithdraw, diff --git a/src/pages/ThorChainLP/queries/hooks/usePool.ts b/src/pages/ThorChainLP/queries/hooks/usePool.ts index 15b96815e30..f3b7430c90c 100644 --- a/src/pages/ThorChainLP/queries/hooks/usePool.ts +++ b/src/pages/ThorChainLP/queries/hooks/usePool.ts @@ -25,6 +25,7 @@ export type Pool = MidgardPoolResponse & { isTradingActive?: boolean isTradingActiveLoading?: boolean isLpDepositEnabled?: boolean + isLpWithdrawEnabled?: boolean } export type PoolStats = { diff --git a/src/pages/ThorChainLP/queries/hooks/usePools.ts b/src/pages/ThorChainLP/queries/hooks/usePools.ts index 20abd66a96e..745dae2a9c0 100644 --- a/src/pages/ThorChainLP/queries/hooks/usePools.ts +++ b/src/pages/ThorChainLP/queries/hooks/usePools.ts @@ -8,7 +8,10 @@ import type { Pool, VolumeStats } from './usePool' import { getPool, getVolumeStats, selectSwapsData } from './usePool' import { bn } from '@/lib/bignumber/bignumber' -import { isLpDepositEnabled } from '@/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled' +import { + isLpDepositEnabled, + isLpWithdrawEnabled, +} from '@/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled' import { useThorchainMimir } from '@/lib/utils/thorchain/hooks/useThorchainMimir' import type { MidgardSwapHistoryResponse } from '@/lib/utils/thorchain/lp/types' import { reactQueries } from '@/react-queries' @@ -136,7 +139,11 @@ export const usePools = () => { const assetId = thorPoolAssetIdToAssetId(pool.asset) if (!assetId) return acc - acc.push({ ...pool, isLpDepositEnabled: isLpDepositEnabled({ mimir, assetId }) }) + acc.push({ + ...pool, + isLpDepositEnabled: isLpDepositEnabled({ mimir, assetId }), + isLpWithdrawEnabled: isLpWithdrawEnabled({ mimir, assetId }), + }) return acc }, [])