Skip to content

Commit

Permalink
solve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
aburkut committed Nov 21, 2024
2 parents aab2c1e + c834699 commit 4e91269
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
78 changes: 78 additions & 0 deletions src/dex/balancer-v2/balancer-v2-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function testForNetwork(
// ContractMethod.multiSwap,
// ContractMethod.megaSwap,
ContractMethod.swapExactAmountIn,
ContractMethod.swapExactAmountInOnBalancerV2,
],
],
[
Expand All @@ -50,6 +51,7 @@ function testForNetwork(
// ContractMethod.buy,
// DirectMethodsV6.directBuy,
ContractMethod.swapExactAmountOut,
ContractMethod.swapExactAmountOutOnBalancerV2,
],
],
]);
Expand Down Expand Up @@ -128,6 +130,82 @@ describe('BalancerV2 E2E', () => {
network,
);

describe.only('GHO -> USDT', () => {
const pairs: { name: string; sellAmount: string; buyAmount: string }[][] =
[
[
{
name: 'GHO',
sellAmount: '1000000000000000000000',
buyAmount: '1000000000',
},
{
name: 'USDT',
sellAmount: '1000000000',
buyAmount: '1000000000000000000000',
},
],
];

const sideToContractMethods = new Map([
[
SwapSide.SELL,
[
ContractMethod.swapExactAmountIn,
ContractMethod.swapExactAmountInOnBalancerV2,
],
],
[
SwapSide.BUY,
[
ContractMethod.swapExactAmountOut,
ContractMethod.swapExactAmountOutOnBalancerV2,
],
],
]);

sideToContractMethods.forEach((contractMethods, side) =>
describe(`${side}`, () => {
contractMethods.forEach((contractMethod: string) => {
pairs.forEach(pair => {
describe(`${contractMethod}`, () => {
it(`${pair[0].name} -> ${pair[1].name}`, async () => {
await testE2E(
tokens[pair[0].name],
tokens[pair[1].name],
holders[pair[0].name],
side === SwapSide.SELL
? pair[0].sellAmount
: pair[0].buyAmount,
side,
dexKey,
contractMethod as any,
network,
provider,
);
});
it(`${pair[1].name} -> ${pair[0].name}`, async () => {
await testE2E(
tokens[pair[1].name],
tokens[pair[0].name],
holders[pair[1].name],
side === SwapSide.SELL
? pair[1].sellAmount
: pair[1].buyAmount,
side,
dexKey,
contractMethod as any,
network,
provider,
);
});
});
});
});
}),
);
});

describe('Weighted Pool', () => {
const sideToContractMethods = new Map([
[
Expand Down
2 changes: 2 additions & 0 deletions src/dex/balancer-v2/balancer-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export class BalancerV2EventPool extends StatefulEventSubscriber<PoolStateMap> {
buySupportedPoolTypes: Set<BalancerPoolTypes> = new Set([
BalancerPoolTypes.Weighted,
BalancerPoolTypes.GyroE,
BalancerPoolTypes.ComposableStable,
]);

eventSupportedPoolTypes: BalancerPoolTypes[] = [
Expand Down Expand Up @@ -868,6 +869,7 @@ export class BalancerV2
this.logger.error(`getState returned null`);
}
const eventPoolStates = { ...(eventPoolStatesRO || {}) };

for (const addr of this.eventDisabledPools) delete eventPoolStates[addr];

// Fetch previously cached non-event pool states
Expand Down

0 comments on commit 4e91269

Please sign in to comment.