Skip to content
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

hotfix: Single asset exit options #3839

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/components/forms/pool_actions/WithdrawForm/WithdrawForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import WithdrawPreviewModal from './components/WithdrawPreviewModal/WithdrawPrev
import { useTokens } from '@/providers/tokens.provider';
import {
isPreMintedBptType,
tokensListExclBpt,
usePoolHelpers,
} from '@/composables/usePoolHelpers';
import { useI18n } from 'vue-i18n';
Expand Down Expand Up @@ -55,7 +56,7 @@ const {
hasAmountsOut,
validAmounts,
hasBpt,
shouldUseSwapExit,
shouldUseRecoveryExit,
} = useExitPool();

const { isWrappedNativeAssetPool } = usePoolHelpers(pool);
Expand All @@ -71,15 +72,17 @@ const hasValidInputs = computed(
(): boolean => validAmounts.value && hasAcceptedHighPriceImpact.value
);

const tokensList = computed(() => tokensListExclBpt(pool.value));

// Limit token select modal to a subset.
const subsetTokens = computed((): string[] => {
if (!pool.value.isInRecoveryMode && isPreMintedBptType(pool.value.poolType))
if (!shouldUseRecoveryExit.value && isPreMintedBptType(pool.value.poolType))
return [];

if (isWrappedNativeAssetPool.value)
return [nativeAsset.address, ...pool.value.tokensList];
return [nativeAsset.address, ...tokensList.value];

return pool.value.tokensList;
return tokensList.value;
});

const excludedTokens = computed((): string[] => {
Expand All @@ -98,9 +101,10 @@ onBeforeMount(() => {
if (!hasBpt.value)
router.push({ name: 'pool', params: { networkSlug, id: props.pool.id } });

singleAmountOut.address = shouldUseSwapExit.value
? wrappedNativeAsset.value.address
: pool.value.tokensList[0];
singleAmountOut.address =
subsetTokens.value.length === 0
? wrappedNativeAsset.value.address
: tokensList.value[0];
});
</script>

Expand Down
1 change: 1 addition & 0 deletions src/providers/local/exit-pool.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ export const exitPoolProvider = (
relayerSignature,
relayerApprovalTx,
shouldUseSwapExit,
shouldUseRecoveryExit,

// methods
setIsSingleAssetExit,
Expand Down