diff --git a/lib/modules/pool/alerts/usePoolAlerts.spec.tsx b/lib/modules/pool/alerts/usePoolAlerts.spec.tsx index 282501924..ba86bf2a1 100644 --- a/lib/modules/pool/alerts/usePoolAlerts.spec.tsx +++ b/lib/modules/pool/alerts/usePoolAlerts.spec.tsx @@ -50,6 +50,12 @@ describe('Creates pool alerts for', () => { "learnMoreLink": "https://forum.balancer.fi/t/vulnerability-found-in-some-pools/5102/1", "status": "error", }, + { + "content": "This pool is in recovery mode", + "identifier": "poolIsInRecoveryMode", + "isSoftWarning": false, + "status": "warning", + }, ] `) }) diff --git a/lib/modules/pool/alerts/usePoolAlerts.tsx b/lib/modules/pool/alerts/usePoolAlerts.tsx index 988f9aa0c..c0fb42ce6 100644 --- a/lib/modules/pool/alerts/usePoolAlerts.tsx +++ b/lib/modules/pool/alerts/usePoolAlerts.tsx @@ -128,12 +128,42 @@ export function usePoolAlerts(pool: Pool) { return alerts } + const getPoolAlerts = (pool: Pool): PoolAlert[] => { + const alerts: PoolAlert[] = [] + + if (pool.dynamicData.isPaused && pool.dynamicData.isInRecoveryMode) { + alerts.push({ + identifier: 'poolIsPausedAndInRecoveryMode', + content: 'This pool is paused and in recovery mode', + status: 'warning', + isSoftWarning: false, + }) + } else if (pool.dynamicData.isPaused) { + alerts.push({ + identifier: 'poolIsPaused', + content: 'This pool is paused', + status: 'warning', + isSoftWarning: false, + }) + } else if (pool.dynamicData.isInRecoveryMode) { + alerts.push({ + identifier: 'poolIsInRecoveryMode', + content: 'This pool is in recovery mode', + status: 'warning', + isSoftWarning: false, + }) + } + + return alerts + } + useEffect(() => { const networkPoolAlerts = getNetworkPoolAlerts(pool) const tokenPoolAlerts = getTokenPoolAlerts(pool) const userAlerts = getUserAlerts(pool) + const poolAlerts = getPoolAlerts(pool) - setPoolAlerts([...networkPoolAlerts, ...tokenPoolAlerts, ...userAlerts]) + setPoolAlerts([...networkPoolAlerts, ...tokenPoolAlerts, ...userAlerts, ...poolAlerts]) // eslint-disable-next-line react-hooks/exhaustive-deps }, [pool]) diff --git a/lib/modules/pool/pool.helpers.ts b/lib/modules/pool/pool.helpers.ts index fee0098b8..d9fc1bb26 100644 --- a/lib/modules/pool/pool.helpers.ts +++ b/lib/modules/pool/pool.helpers.ts @@ -259,8 +259,10 @@ export function hasReviewedRateProvider(token: GqlPoolTokenDetail): boolean { export function shouldBlockAddLiquidity(pool: Pool) { const poolTokens = pool.poolTokens as GqlPoolTokenDetail[] - // If pool is an LBP, we should block adding liquidity - if (isLBP(pool.type)) return true + // If pool is an LBP, paused or in recovery mode, we should block adding liquidity + if (isLBP(pool.type) || pool.dynamicData.isPaused || pool.dynamicData.isInRecoveryMode) { + return true + } return poolTokens.some(token => { // if token is not allowed - we should block adding liquidity