Skip to content

Commit

Permalink
Add new pool available announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
agualis committed Jun 22, 2023
1 parent dd22919 commit 6705437
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useNetwork from '@/composables/useNetwork';
import {
deprecatedDetails,
gaugeMigrationDetails,
newVersionDetails,
} from '@/composables/usePoolHelpers';
import NewPoolData from './NewPoolData.vue';
import usePoolsQuery from '@/composables/queries/usePoolsQuery';
Expand All @@ -29,7 +30,10 @@ const { networkSlug } = useNetwork();
const { t } = useI18n();
const migrationInfo = computed(
() => deprecatedDetails(props.poolId) || gaugeMigrationDetails(props.poolId)
() =>
deprecatedDetails(props.poolId) ||
gaugeMigrationDetails(props.poolId) ||
newVersionDetails(props.poolId)
);
const newPoolQueryEnabled = computed(
Expand Down
18 changes: 17 additions & 1 deletion src/composables/usePoolHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@/lib/utils';
import { includesWstEth } from '@/lib/utils/balancer/lido';
import { configService } from '@/services/config/config.service';
import { DeprecatedDetails } from '@/types/pools';
import { DeprecatedDetails, NewVersionAvailableDetails } from '@/types/pools';

import { AnyPool, Pool, PoolToken, SubPool } from '@/services/pool/types';
import { hasBalEmissions } from './useAPR';
Expand Down Expand Up @@ -580,6 +580,17 @@ export function deprecatedDetails(id: string): DeprecatedDetails | undefined {
return POOLS.Deprecated?.[id.toLowerCase()];
}

/**
* Checks if pool ID is included in the list of pools that have a new version available (but are not deprecated yet)
* @param {string} id - The pool ID to check
* @returns {boolean} True if included in list
*/
export function newVersionDetails(
id: string
): NewVersionAvailableDetails | undefined {
return POOLS.NewVersionAvailable?.[id.toLowerCase()];
}

/**
* Checks if pool ID is included in the list of deprecated pools
* @param {string} id - The pool ID to check
Expand Down Expand Up @@ -730,6 +741,10 @@ export function usePoolHelpers(pool: Ref<AnyPool> | Ref<undefined>) {
return !!pool.value && !!POOLS.Deprecated?.[pool.value.id];
});

const isNewPoolAvailable = computed(() => {
return !!pool.value && !!POOLS.NewVersionAvailable?.[pool.value.id];
});

return {
// computed
isStablePool,
Expand All @@ -750,6 +765,7 @@ export function usePoolHelpers(pool: Ref<AnyPool> | Ref<undefined>) {
isMainnetWstETHPool,
hasNonApprovedRateProviders,
isDeprecatedPool,
isNewPoolAvailable,
poolJoinTokens,
// methods
isStable,
Expand Down
26 changes: 14 additions & 12 deletions src/lib/config/mainnet/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,20 @@ const pools: Pools = {
'0x4fd4687ec38220f805b6363c3c1e52d0df3b5023000200000000000000000473', // Euler Boosted USD/wstETH
'0x133d241f225750d2c92948e464a5a80111920331000000000000000000000476', // Euler Boosted USD/dola
],
NewVersionAvailable: {
'0x32296969ef14eb0c6d29669c550d4a0449130230000200000000000000000080': {
newPool:
'0xe0fcbf4d98f0ad982db260f86cf28b49845403c5000000000000000000000504',
description: 'newVersion.Aave3',
title: 'announcement',
},
'0x9c6d47ff73e0f5e51be5fd53236e3f595c5793f200020000000000000000042c': {
newPool:
'0x9001cbbd96f54a658ff4e6e65ab564ded76a543100000000000000000000050a',
description: 'newVersion.Aave3',
title: 'announcement',
},
},
Deprecated: {
'0x06df3b2bbb68adc8b0e302443692037ed9f91b42000000000000000000000063': {},
'0x7b50775383d3d6f0215a8f290f2c9e2eebbeceb20000000000000000000000fe': {},
Expand Down Expand Up @@ -538,18 +552,6 @@ const pools: Pools = {
'0x04248aabca09e9a1a3d5129a7ba05b7f17de768400000000000000000000050e',
description: 'deprecatedPool.gaugeKilledReason',
},
'0x32296969ef14eb0c6d29669c550d4a0449130230000200000000000000000080': {
newPool:
'0xe0fcbf4d98f0ad982db260f86cf28b49845403c5000000000000000000000504',
description: 'deprecatedPool.newVersion',
title: 'announcement',
},
'0x9c6d47ff73e0f5e51be5fd53236e3f595c5793f200020000000000000000042c': {
newPool:
'0x9001cbbd96f54a658ff4e6e65ab564ded76a543100000000000000000000050a',
description: 'deprecatedPool.newVersion',
title: 'announcement',
},
},
GaugeMigration: {},
BrandedRedirect: {
Expand Down
6 changes: 4 additions & 2 deletions src/locales/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,10 @@
"title": "Move your liquidity for future BAL incentives",
"description": "Liquidity mining incentives are being phased out for this pool, since upgraded pools are now live. LPs are encouraged to unstake existing positions, withdraw their liquidity and add it to the newly incentivized pools."
},
"gaugeKilledReason": "This pool's gauge will soon be killed. A new version of this pool has been created that uses Aave v3.",
"newVersion": "A new version of this pool has been created that uses Aave v3"
"gaugeKilledReason": "This pool's gauge will soon be killed. A new version of this pool has been created that uses Aave v3."
},
"newVersion": {
"Aave3": "A new version of this pool has been created that uses Aave v3"
},
"highPriceImpact": "High price impact",
"highPriceImpactDetailed": "This swap is significantly moving the market price.",
Expand Down
7 changes: 6 additions & 1 deletion src/pages/pool/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const {
isLiquidityBootstrappingPool,
isComposableStableLikePool,
isDeprecatedPool,
isNewPoolAvailable,
} = usePoolHelpers(poolQuery.data);
//#endregion
Expand Down Expand Up @@ -318,7 +319,11 @@ watch(
class="pool-locking"
/>
<PoolMigrationCard
v-if="poolId && isWalletReady && isDeprecatedPool"
v-if="
poolId &&
isWalletReady &&
(isDeprecatedPool || isNewPoolAvailable)
"
:poolId="poolId"
/>
</BalStack>
Expand Down
3 changes: 3 additions & 0 deletions src/types/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export type DeprecatedDetails = {
title?: string;
};

export type NewVersionAvailableDetails = DeprecatedDetails;

export enum PoolMigrationType {
AAVE_BOOSTED_POOL = 'aaveBoostedPool',
STABAL3_POOL = 'stabal3Pool',
Expand Down Expand Up @@ -103,6 +105,7 @@ export type Pools = {
ExitViaInternalBalance?: string[];
BrandedRedirect?: Record<string, string>;
Deprecated?: Record<string, DeprecatedDetails>;
NewVersionAvailable?: Record<string, NewVersionAvailableDetails>;
GaugeMigration?: Record<string, DeprecatedDetails>;
Migrations?: Record<string, PoolMigrationInfo>;
Issues?: Partial<Record<PoolWarning, string[]>>;
Expand Down

0 comments on commit 6705437

Please sign in to comment.