From edd97f4bef5cbe897870243821d25b61474e6fa1 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Tue, 25 Jul 2023 19:25:14 +1000 Subject: [PATCH] Fix tests for allowing weighted pools on testnets --- src/composables/useDisabledJoinPool.spec.ts | 21 ++++++++++++++++++++- src/composables/useNetwork.ts | 8 ++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/composables/useDisabledJoinPool.spec.ts b/src/composables/useDisabledJoinPool.spec.ts index 432e672ada..9dcbc16f08 100644 --- a/src/composables/useDisabledJoinPool.spec.ts +++ b/src/composables/useDisabledJoinPool.spec.ts @@ -45,7 +45,10 @@ it('disables joins for pools created after timestamp (2023-03-29) with non vette ); }); -it('disables joins for weigthed pools created after timestamp (2023-03-29) that are not in the weighted allow list', async () => { +it('disables joins for weighted pools created after timestamp (2023-03-29) that are not in the weighted allow list', async () => { + const { networkId } = useNetwork(); + networkId.value = 1; + const pool = BoostedPoolMock; pool.createTime = dateToUnixTimestamp('2023-03-30'); //Created after 29 March pool.poolType = PoolType.Weighted; @@ -60,6 +63,22 @@ it('disables joins for weigthed pools created after timestamp (2023-03-29) that ).toBeTrue(); }); +it('allows joins for weighted pools on test networks created after timestamp (2023-03-29) that are not in the weighted allow list', async () => { + const { networkId } = useNetwork(); + networkId.value = 5; + + const pool = BoostedPoolMock; + pool.createTime = dateToUnixTimestamp('2023-03-30'); //Created after 29 March + pool.poolType = PoolType.Weighted; + const { disableJoinsReason } = await mountVettedTokensInPool(pool); + + pool.tokens[0].address = randomAddress(); + + expect( + disableJoinsReason.value.nonAllowedWeightedPoolAfterTimestamp + ).toBeFalse(); +}); + it('does not disables joins for pools created before 29 march', async () => { const pool = BoostedPoolMock; pool.createTime = dateToUnixTimestamp('2023-03-28'); //Created before 29 March diff --git a/src/composables/useNetwork.ts b/src/composables/useNetwork.ts index 2882fc5430..d1e3e18b73 100644 --- a/src/composables/useNetwork.ts +++ b/src/composables/useNetwork.ts @@ -40,8 +40,12 @@ export const isArbitrum = computed(() => networkId.value === Network.ARBITRUM); export const isGnosis = computed(() => networkId.value === Network.GNOSIS); export const isGoerli = computed(() => networkId.value === Network.GOERLI); -export const hasBridge = computed(() => !!networkConfig.bridgeUrl); -export const isTestnet = computed(() => !!networkConfig.testNetwork); +export const hasBridge = computed( + () => !!config[networkId.value].bridgeUrl +); +export const isTestnet = computed( + () => !!config[networkId.value].testNetwork +); export const isEIP1559SupportedNetwork = computed( () => configService.network.supportsEIP1559