diff --git a/package.json b/package.json index a653af81d..63b88ca1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paraswap/dex-lib", - "version": "3.11.3", + "version": "3.11.4", "main": "build/index.js", "types": "build/index.d.ts", "repository": "https://github.com/paraswap/paraswap-dex-lib", diff --git a/src/dex/balancer-v2/balancer-v2-e2e.test.ts b/src/dex/balancer-v2/balancer-v2-e2e.test.ts index c8f1ff3c0..491b06c0e 100644 --- a/src/dex/balancer-v2/balancer-v2-e2e.test.ts +++ b/src/dex/balancer-v2/balancer-v2-e2e.test.ts @@ -41,6 +41,7 @@ function testForNetwork( // ContractMethod.multiSwap, // ContractMethod.megaSwap, ContractMethod.swapExactAmountIn, + ContractMethod.swapExactAmountInOnBalancerV2, ], ], [ @@ -50,6 +51,7 @@ function testForNetwork( // ContractMethod.buy, // DirectMethodsV6.directBuy, ContractMethod.swapExactAmountOut, + ContractMethod.swapExactAmountOutOnBalancerV2, ], ], ]); @@ -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([ [ diff --git a/src/dex/balancer-v2/balancer-v2.ts b/src/dex/balancer-v2/balancer-v2.ts index 97f60f1aa..19aedc760 100644 --- a/src/dex/balancer-v2/balancer-v2.ts +++ b/src/dex/balancer-v2/balancer-v2.ts @@ -266,6 +266,7 @@ export class BalancerV2EventPool extends StatefulEventSubscriber { buySupportedPoolTypes: Set = new Set([ BalancerPoolTypes.Weighted, BalancerPoolTypes.GyroE, + BalancerPoolTypes.ComposableStable, ]); eventSupportedPoolTypes: BalancerPoolTypes[] = [ @@ -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