Skip to content

Commit

Permalink
Fix tests for allowing weighted pools on testnets
Browse files Browse the repository at this point in the history
  • Loading branch information
timjrobinson committed Jul 25, 2023
1 parent 92a9c6b commit edd97f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
21 changes: 20 additions & 1 deletion src/composables/useDisabledJoinPool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/composables/useNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>(() => !!networkConfig.bridgeUrl);
export const isTestnet = computed<boolean>(() => !!networkConfig.testNetwork);
export const hasBridge = computed<boolean>(
() => !!config[networkId.value].bridgeUrl
);
export const isTestnet = computed<boolean>(
() => !!config[networkId.value].testNetwork
);

export const isEIP1559SupportedNetwork = computed(
() => configService.network.supportsEIP1559
Expand Down

0 comments on commit edd97f4

Please sign in to comment.