Skip to content

feat: thorchain LP global halt checks#11221

Merged
0xApotheosis merged 4 commits intodevelopfrom
feat_thorchain_lp_disable_deposit_withdraw_revert
Nov 27, 2025
Merged

feat: thorchain LP global halt checks#11221
0xApotheosis merged 4 commits intodevelopfrom
feat_thorchain_lp_disable_deposit_withdraw_revert

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Nov 27, 2025

Description

This PR:

Issue (if applicable)

closes N/A

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Low - LP-specific

Testing

Engineering

  • run curl -s https://api.thorchain.shapeshift.com/lcd/thorchain/mimir | grep -o "\"PAUSELP\":[0-9]*"
  • if it's 1 (LP halted) then things should look as in the screenshots below on the left
  • else if mimir is set to 0 (LP not halted), LP should work (assuming specific pool enabled)

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)
  • paste the link above in browser
  • search for "PAUSELP" and ditto re: 1/0

Screenshots (if applicable)

  • this diff (left) vs. develop (right)
Screenshot 2025-11-27 at 20 23 54 Screenshot 2025-11-27 at 20 24 24 Screenshot 2025-11-27 at 20 24 48

Summary by CodeRabbit

  • New Features
    • Per-pool enablement added for LP deposits and withdrawals on Thorchain.
    • Per-pool + feature-flag gating now controls UI availability and error messaging for add/remove liquidity.
  • Bug Fixes / Improvements
    • Global pause for LP operations now short-circuits deposit/withdraw availability.
    • Pool lists and status indicators updated to reflect per-pool withdrawal availability.

✏️ Tip: You can customize this high-level summary in your review settings.

@gomesalexandre gomesalexandre requested a review from a team as a code owner November 27, 2025 19:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds symmetric LP withdrawal enablement: new isLpWithdrawEnabled function and useIsLpWithdrawEnabled hook, wires per-pool withdrawal flags into pool data and UI, adds a global PAUSELP guard to deposit logic, and updates components to combine feature flags with per-pool enablement for deposit/withdraw gating.

Changes

Cohort / File(s) Summary
LP enablement hooks
src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
Adds isLpWithdrawEnabled() and useIsLpWithdrawEnabled() mirroring deposit logic; isLpDepositEnabled() gains an early-exit mimir.PAUSELP guard. Exports updated.
Pool types & composition
src/pages/ThorChainLP/queries/hooks/usePool.ts, src/pages/ThorChainLP/queries/hooks/usePools.ts
Adds optional isLpWithdrawEnabled?: boolean to Pool type; usePools computes and includes isLpWithdrawEnabled (uses mimir + assetId) alongside isLpDepositEnabled.
Available pools UI
src/pages/ThorChainLP/AvailablePools.tsx
Introduces per-pool gating that combines feature flags (ThorchainLpDeposit, ThorchainLpWithdraw) with pool-level isLpDepositEnabled/isLpWithdrawEnabled to derive per-pool interaction disabled state; updates memo deps and row rendering.
Add liquidity UI
src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
Adds new prop isThorchainLpDepositEnabledForPool?: boolean; unifies deposit gating into isThorchainLpDepositEnabled (feature flag + pool-level) and updates conditionals, effects and error copy accordingly.
Remove liquidity UI
src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
Imports and uses useIsLpWithdrawEnabled(poolAsset?.assetId) and ThorchainLpWithdraw flag; computes isThorchainLpWithdrawEnabledForPool (flag + pool-level) and updates disablement logic and effect deps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check consistency of PAUSELP handling and undefined/boolean return shapes between deposit and withdraw helpers.
  • Verify Pool type change is propagated correctly where Pool is consumed.
  • Validate feature-flag + per-pool boolean combinations and updated dependency arrays in affected components.

Possibly related PRs

Suggested reviewers

  • NeOMakinG
  • 0xApotheosis

Poem

🐰 I hopped through mimir, flags in paw,
Found PAUSELP’s pause and fixed the flaw,
Withdrawals mirrored deposits true,
Pools now speak both yes and no too —
🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing global halt checks (PAUSELP mimir entry) for Thorchain LP deposit and withdraw operations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6fdbb22 and 113f587.

📒 Files selected for processing (6)
  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (2 hunks)
  • src/pages/ThorChainLP/AvailablePools.tsx (3 hunks)
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx (3 hunks)
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx (4 hunks)
  • src/pages/ThorChainLP/queries/hooks/usePool.ts (1 hunks)
  • src/pages/ThorChainLP/queries/hooks/usePools.ts (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gomesalexandre gomesalexandre changed the base branch from develop to feat_thorchain_lp_disable_deposit_withdraw November 27, 2025 19:29
return !isDisabled
}

export const isLpWithdrawEnabled = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks for global halt - not asset-specific, no such thing for withdraws

mimir: ThorchainMimir
assetId: AssetId | undefined
}) => {
if (!assetId) return undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here for conschischtenschy with deposit variant only

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx (1)

194-197: Consider handling undefined state for per-pool enablement.

The combined check isThorchainLpWithdrawFlagEnabled && isThorchainLpWithdrawEnabledForPool will evaluate to falsy when isThorchainLpWithdrawEnabledForPool is undefined (during initial loading or when poolAsset?.assetId is undefined). This means the UI will show "disabled" state during loading.

If this is intentional behavior (fail-closed during loading), consider adding a comment explaining this. Otherwise, you may want to handle the loading state explicitly to avoid showing a misleading "disabled" message.

Example to distinguish between loading and actually disabled:

  const isThorchainLpWithdrawFlagEnabled = useFeatureFlag('ThorchainLpWithdraw')
  const { data: isThorchainLpWithdrawEnabledForPool } = useIsLpWithdrawEnabled(poolAsset?.assetId)
  const isThorchainLpWithdrawEnabled =
-    isThorchainLpWithdrawFlagEnabled && isThorchainLpWithdrawEnabledForPool
+    isThorchainLpWithdrawFlagEnabled && isThorchainLpWithdrawEnabledForPool === true

This would make the undefined case more explicit (though the current behavior is likely acceptable).

src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx (1)

1462-1479: Remove redundant dependency in errorCopy useMemo.

The errorCopy memo includes isThorchainLpDepositEnabledForPool (line 1477) in its dependency array, but this value is not used in the memo body. Only the combined value isThorchainLpDepositEnabled (line 1465) is used.

Since isThorchainLpDepositEnabled is derived from isThorchainLpDepositEnabledForPool, including both in the dependency array is redundant.

  }, [
    isConnected,
    isSmartContractAccountAddress,
    isThorchainLpDepositEnabled,
    isTradingActive,
    isChainHalted,
    notEnoughFeeAssetError,
    notEnoughPoolAssetError,
    notEnoughRuneError,
    notEnoughRuneFeeError,
    poolAsset,
    poolAssetFeeAsset,
    runeAsset,
    translate,
    walletSupportsOpportunity,
-    isThorchainLpDepositEnabledForPool,
    isStagedAsymDeposit,
  ])
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fb25b01 and 6fdbb22.

📒 Files selected for processing (4)
  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (2 hunks)
  • src/pages/ThorChainLP/AvailablePools.tsx (2 hunks)
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx (5 hunks)
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Never assume a library is available - always check imports/package.json first
Prefer composition over inheritance
Write self-documenting code with clear variable and function names
Keep functions small and focused on a single responsibility
Avoid deep nesting - use early returns instead
Prefer procedural and easy to understand code
Never expose, log, or commit secrets, API keys, or credentials
Validate all inputs, especially user inputs
Handle errors gracefully with meaningful messages
Don't silently catch and ignore exceptions
Log errors appropriately for debugging
Provide fallback behavior when possible
Use appropriate data structures for the task
Never add code comments unless explicitly requested
When modifying code, do not add comments that reference previous implementations or explain what changed. Comments should only describe the current logic and functionality.
Use meaningful names for branches, variables, and functions
Always run yarn lint --fix and yarn type-check after making changes
Avoid let variable assignments - prefer const with inline IIFE switch statements or extract to functions for conditional logic

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Avoid useEffect where practical - use it only when necessary and following best practices
Avoid 'any' types - use specific type annotations instead
For default values with user overrides, use computed values (useMemo) instead of useEffect - pattern: userSelected ?? smartDefault ?? fallback
When function parameters are unused due to interface requirements, refactor the interface or implementation to remove them rather than prefixing with underscore
Sanitize data before displaying to prevent XSS
Memoize aggressively - wrap component variables in useMemo and callbacks in useCallback where possible
For static JSX icon elements (e.g., <TbCopy />) that don't depend on state/props, define them as constants outside the component to avoid re-renders instead of using useMemo
Account for light/dark mode using useColorModeValue hook
Account for responsive mobile designs in all UI components
When applying styles, use the existing standards and conventions of the codebase
Use Chakra UI components and conventions
All copy/text must use translation keys - never hardcode strings
Use the translation hook: useTranslate() from react-polyglot
Use useFeatureFlag('FlagName') hook to access feature flag values in components
Prefer type over interface for type definitions
Use strict typing - avoid any
Use Nominal types for domain identifiers (e.g., WalletId, AccountId)
Import types from @shapeshiftoss/caip for chain/account/asset IDs
Use useAppSelector for Redux state
Use useAppDispatch for Redux actions
Memoize expensive computations with useMemo
Memoize callbacks with useCallback

**/*.{ts,tsx}: Use Result<T, E> pattern for error handling in swappers and APIs; ALWAYS use Ok() and Err() from @sniptt/monads; AVOID throwing within swapper API implementations
ALWAYS use custom error classes from @shapeshiftoss/errors with meaningful error codes for internationalization and relevant details in error objects
ALWAYS wrap async op...

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{tsx,jsx}: ALWAYS wrap React components in error boundaries and provide user-friendly fallback components with error logging
ALWAYS use useErrorToast hook for displaying errors with translated error messages and handle different error types appropriately

Use PascalCase for React component names and match the component name to the file name

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*.{js,jsx,ts,tsx}: Use camelCase for variables, functions, and methods with descriptive names that explain the purpose
Use verb prefixes for functions that perform actions (e.g., fetch, validate, execute, update, calculate)
Use UPPER_SNAKE_CASE for constants and configuration values with descriptive names
Use handle prefix for event handlers with descriptive names in camelCase
Use descriptive boolean variable names with is, has, can, should prefixes
Use named exports for components, functions, and utilities instead of default exports
Use descriptive import names and avoid renaming imports unless necessary
Avoid non-descriptive variable names like data, item, obj, and single-letter variable names except in loops
Avoid abbreviations in names unless they are widely understood
Avoid generic function names like fn, func, or callback

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

**/*.{jsx,tsx}: ALWAYS use useMemo for expensive computations, object/array creations, and filtered data
ALWAYS use useMemo for derived values and computed properties
ALWAYS use useMemo for conditional values and simple transformations
ALWAYS use useCallback for event handlers and functions passed as props
ALWAYS use useCallback for any function that could be passed as a prop or dependency
ALWAYS include all dependencies in useEffect, useMemo, useCallback dependency arrays
NEVER use // eslint-disable-next-line react-hooks/exhaustive-deps unless absolutely necessary, and ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components; NEVER use default exports for components
KEEP component files under 200 lines when possible; BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly in async operations
ALWAYS provide user-friendly error messages in error handling
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components using React.lazy for code splitting
ALWAYS use Suspense wrapper for lazy loaded components
USE local state for component-level state; LIFT state up when needed across multiple components; USE Context for avoiding prop drilling; USE Redux only for global state shared across multiple places
Wrap components receiving props with memo for performance optimization

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

Ensure TypeScript types are explicit and proper; avoid use of any type

Files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
🧠 Learnings (8)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11170
File: patches/@shapeshiftoss+bitcoinjs-lib+7.0.0-shapeshift.0.patch:9-19
Timestamp: 2025-11-25T21:43:10.838Z
Learning: In shapeshift/web, gomesalexandre will not expand PR scope to fix latent bugs in unused API surface (like bitcoinjs-lib patch validation methods) when comprehensive testing proves the actual used code paths work correctly, preferring to avoid costly hdwallet/web verdaccio publish cycles and full regression testing for conceptual issues with zero runtime impact.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx:97-108
Timestamp: 2025-08-14T17:54:32.563Z
Learning: In ReusableLpStatus component (src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx), the txAssets dependency is stable from first render because poolAsset, baseAsset, actionSide, and action are all defined first render, making the current txAssetsStatuses initialization pattern safe without needing useEffect synchronization.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-08-22T15:07:18.021Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.

Applied to files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
📚 Learning: 2025-08-14T17:54:32.563Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx:97-108
Timestamp: 2025-08-14T17:54:32.563Z
Learning: In ReusableLpStatus component (src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx), the txAssets dependency is stable from first render because poolAsset, baseAsset, actionSide, and action are all defined first render, making the current txAssetsStatuses initialization pattern safe without needing useEffect synchronization.

Applied to files:

  • src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx
  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
📚 Learning: 2025-08-13T13:45:25.748Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10265
File: src/pages/ThorChainLP/queries/hooks/usePools.ts:93-0
Timestamp: 2025-08-13T13:45:25.748Z
Learning: In the ShapeShift web app, inbound addresses data for Thorchain pools requires aggressive caching settings (staleTime: 0, gcTime: 0, refetchInterval: 60_000) to ensure trading status and LP deposit availability are always current. This is intentional business-critical behavior, not a performance issue to be optimized.

Applied to files:

  • src/pages/ThorChainLP/AvailablePools.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
📚 Learning: 2025-08-14T17:56:23.721Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:545-566
Timestamp: 2025-08-14T17:56:23.721Z
Learning: gomesalexandre prefers not to extract helper functions for toast rendering patterns in TransactionRow.tsx (src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx), considering it over-abstraction even when there's code duplication between deposit and withdraw flows.

Applied to files:

  • src/pages/ThorChainLP/AvailablePools.tsx
📚 Learning: 2025-11-24T21:20:04.979Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T21:20:04.979Z
Learning: Applies to **/*.{ts,tsx} : Use `useFeatureFlag('FlagName')` hook to access feature flag values in components

Applied to files:

  • src/pages/ThorChainLP/AvailablePools.tsx
📚 Learning: 2025-09-04T17:29:59.479Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10380
File: src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx:28-33
Timestamp: 2025-09-04T17:29:59.479Z
Learning: In shapeshift/web, the useGetPopularAssetsQuery function in src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx intentionally uses primaryAssets[assetId] instead of falling back to assets[assetId]. The design distributes primary assets across chains by iterating through their related assets and adding the primary asset to each related asset's chain. This ensures primary assets appear in all chains where they have related assets, supporting the grouped asset system.

Applied to files:

  • src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx
  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
📚 Learning: 2025-08-08T15:00:49.887Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10231
File: src/components/AssetSearch/components/AssetList.tsx:2-2
Timestamp: 2025-08-08T15:00:49.887Z
Learning: Project shapeshift/web: NeOMakinG prefers avoiding minor a11y/UI nitpicks (e.g., adding aria-hidden to decorative icons in empty states like src/components/AssetSearch/components/AssetList.tsx) within feature PRs; defer such suggestions to a follow-up instead of blocking the PR.

Applied to files:

  • src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx
🧬 Code graph analysis (3)
src/pages/ThorChainLP/AvailablePools.tsx (1)
src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (2)
  • useIsLpDepositEnabled (50-56)
  • useIsLpWithdrawEnabled (58-64)
src/pages/ThorChainLP/components/RemoveLiquidity/RemoveLiquidityInput.tsx (1)
src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (1)
  • useIsLpWithdrawEnabled (58-64)
src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx (1)
src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (1)
  • useIsLpDepositEnabled (50-56)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (3)
src/lib/utils/thorchain/hooks/useIsThorchainLpDepositEnabled.tsx (2)

17-18: LGTM!

The PAUSELP global halt guard correctly short-circuits deposit enablement checks when LP operations are paused globally.


36-48: The review comment's concern is not applicable—no pool-specific withdrawal pause mimirs exist in the Thorchain protocol.

The codebase defines ThorchainMimir types in src/lib/utils/thorchain/types.ts. The mimir definitions include global and pool-specific deposit pause controls (PAUSELP and PAUSELPDEPOSIT-*), but there are no PAUSELPWITHDRAW-* or similar withdrawal-specific pause mimirs. The isLpWithdrawEnabled function correctly implements the protocol's design: withdrawals are controlled only via the global PAUSELP flag, while deposits have additional pool-level controls. The unconditional true return is correct.

src/pages/ThorChainLP/components/AddLiquidity/AddLiquidityInput.tsx (1)

541-544: LGTM! Unified deposit enablement check.

The combined check correctly gates deposits by requiring both the global feature flag and per-pool enablement. The pattern matches the withdrawal logic in RemoveLiquidityInput.tsx.

Note: Similar to the withdrawal logic, isThorchainLpDepositEnabled will be falsy when isThorchainLpDepositEnabledForPool is undefined (during loading). This fail-closed behavior is likely intentional and safe.

@gomesalexandre gomesalexandre marked this pull request as draft November 27, 2025 19:34
@gomesalexandre gomesalexandre force-pushed the feat_thorchain_lp_disable_deposit_withdraw_revert branch from 6fdbb22 to c1bd1d9 Compare November 27, 2025 19:41

const isThorchainLpWithdrawEnabled = useFeatureFlag('ThorchainLpWithdraw')
const isThorchainLpWithdrawFlagEnabled = useFeatureFlag('ThorchainLpWithdraw')
const { data: isThorchainLpWithdrawEnabledForPool } = useIsLpWithdrawEnabled(poolAsset?.assetId)
Copy link
Contributor Author

@gomesalexandre gomesalexandre Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not exactly true re: "for pool", but keeps things consistent

@gomesalexandre gomesalexandre force-pushed the feat_thorchain_lp_disable_deposit_withdraw_revert branch from c1bd1d9 to cb6b99e Compare November 27, 2025 19:44
@gomesalexandre gomesalexandre force-pushed the feat_thorchain_lp_disable_deposit_withdraw_revert branch from cb6b99e to b0e4865 Compare November 27, 2025 19:49
@gomesalexandre gomesalexandre marked this pull request as ready for review November 27, 2025 19:50
Base automatically changed from feat_thorchain_lp_disable_deposit_withdraw to develop November 27, 2025 22:58
@0xApotheosis 0xApotheosis self-assigned this Nov 27, 2025
Copy link
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

curl -s https://api.thorchain.shapeshift.com/lcd/thorchain/mimir | grep -o "\"PAUSELP\":[0-9]*"
"PAUSELP":1
Image

@0xApotheosis 0xApotheosis merged commit 1c667fb into develop Nov 27, 2025
3 of 4 checks passed
@0xApotheosis 0xApotheosis deleted the feat_thorchain_lp_disable_deposit_withdraw_revert branch November 27, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants