-
Notifications
You must be signed in to change notification settings - Fork 201
feat: thorchain LP global halt checks #11221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
0xApotheosis
merged 4 commits into
develop
from
feat_thorchain_lp_disable_deposit_withdraw_revert
Nov 27, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f65e0a8
feat: halt thorchain lp deposit/withdraw
gomesalexandre dc345cc
Revert "feat: halt thorchain lp deposit/withdraw"
gomesalexandre b0e4865
feat: check PAUSELP mimir for THORChain LP deposit/withdraw operations
gomesalexandre 113f587
Merge branch 'develop' into feat_thorchain_lp_disable_deposit_withdra…
gomesalexandre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,10 +33,32 @@ export const isLpDepositEnabled = ({ | |
| return !isDisabled | ||
| } | ||
|
|
||
| export const isLpWithdrawEnabled = ({ | ||
| mimir, | ||
| assetId, | ||
| }: { | ||
| mimir: ThorchainMimir | ||
| assetId: AssetId | undefined | ||
| }) => { | ||
| if (!assetId) return undefined | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here for conschischtenschy with deposit variant only |
||
|
|
||
| if (mimir.PAUSELP) return false | ||
|
|
||
| return true | ||
| } | ||
|
|
||
| export const useIsLpDepositEnabled = (assetId: AssetId | undefined) => { | ||
| return useThorchainMimir({ | ||
| chainId: thorchainChainId, | ||
| enabled: Boolean(assetId), | ||
| select: mimir => isLpDepositEnabled({ mimir, assetId }), | ||
| }) | ||
| } | ||
|
|
||
| export const useIsLpWithdrawEnabled = (assetId: AssetId | undefined) => { | ||
| return useThorchainMimir({ | ||
| chainId: thorchainChainId, | ||
| enabled: Boolean(assetId), | ||
| select: mimir => isLpWithdrawEnabled({ mimir, assetId }), | ||
| }) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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<RemoveLiquidityInputProps> = ({ | |
| fromAssetId(assetId).chainId, | ||
| ) | ||
|
|
||
| const isThorchainLpWithdrawEnabled = useFeatureFlag('ThorchainLpWithdraw') | ||
| const isThorchainLpWithdrawFlagEnabled = useFeatureFlag('ThorchainLpWithdraw') | ||
| const { data: isThorchainLpWithdrawEnabledForPool } = useIsLpWithdrawEnabled(poolAsset?.assetId) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not exactly true re: "for pool", but keeps things consistent |
||
|
|
||
| const currentAccountIdByChainId = useMemo(() => { | ||
| if (!poolAsset) return {} | ||
|
|
@@ -965,7 +967,8 @@ export const RemoveLiquidityInput: React.FC<RemoveLiquidityInputProps> = ({ | |
| 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<RemoveLiquidityInputProps> = ({ | |
| }, [ | ||
| hasEnoughPoolAssetFeeAssetBalanceForTx, | ||
| hasEnoughRuneBalanceForTx, | ||
| isThorchainLpWithdrawEnabled, | ||
| isThorchainLpWithdrawFlagEnabled, | ||
| isThorchainLpWithdrawEnabledForPool, | ||
| isTradingActive, | ||
| isChainHalted, | ||
| isUnsupportedWithdraw, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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