@paraswap/dex-lib 4.1.6 → 4.1.7-mwrappedm.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/abi/fluid-dex/resolver.abi.json +0 -30
- package/build/abi/m-token/WrappedM.abi.json +1708 -0
- package/build/dex/aave-v3-stata-v2/config.js +0 -13
- package/build/dex/aave-v3-stata-v2/config.js.map +1 -1
- package/build/dex/algebra/config.js +1 -1
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/balancer-v2/pools/gyro/GyroEPool.js.map +1 -1
- package/build/dex/balancer-v3/balancer-v3-pool.d.ts +1 -6
- package/build/dex/balancer-v3/balancer-v3-pool.js +17 -45
- package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
- package/build/dex/balancer-v3/balancer-v3.d.ts +0 -4
- package/build/dex/balancer-v3/balancer-v3.js +4 -30
- package/build/dex/balancer-v3/balancer-v3.js.map +1 -1
- package/build/dex/balancer-v3/config.js +0 -51
- package/build/dex/balancer-v3/config.js.map +1 -1
- package/build/dex/balancer-v3/getOnChainState.d.ts +2 -1
- package/build/dex/balancer-v3/getOnChainState.js +2 -0
- package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
- package/build/dex/balancer-v3/getPoolsApi.d.ts +1 -2
- package/build/dex/balancer-v3/getPoolsApi.js +10 -17
- package/build/dex/balancer-v3/getPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/getTopPoolsApi.d.ts +1 -5
- package/build/dex/balancer-v3/getTopPoolsApi.js +3 -6
- package/build/dex/balancer-v3/getTopPoolsApi.js.map +1 -1
- package/build/dex/balancer-v3/types.d.ts +1 -4
- package/build/dex/cables/cables.d.ts +1 -1
- package/build/dex/cables/cables.js +7 -26
- package/build/dex/cables/cables.js.map +1 -1
- package/build/dex/fluid-dex/config.js +2 -2
- package/build/dex/fluid-dex/constants.d.ts +1 -1
- package/build/dex/fluid-dex/constants.js +1 -2
- package/build/dex/fluid-dex/constants.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js +1 -3
- package/build/dex/fluid-dex/fluid-dex-liquidity-proxy.js.map +1 -1
- package/build/dex/fluid-dex/fluid-dex.d.ts +5 -4
- package/build/dex/fluid-dex/fluid-dex.js +59 -61
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -1
- package/build/dex/fluid-dex/types.d.ts +0 -3
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/m-token/config.d.ts +3 -0
- package/build/dex/m-token/config.js +19 -0
- package/build/dex/m-token/config.js.map +1 -0
- package/build/dex/m-token/m-token.d.ts +29 -0
- package/build/dex/m-token/m-token.js +145 -0
- package/build/dex/m-token/m-token.js.map +1 -0
- package/build/dex/m-token/m-wrapped-m.d.ts +17 -0
- package/build/dex/m-token/m-wrapped-m.js +50 -0
- package/build/dex/m-token/m-wrapped-m.js.map +1 -0
- package/build/dex/m-token/types.d.ts +12 -0
- package/build/dex/m-token/types.js +3 -0
- package/build/dex/m-token/types.js.map +1 -0
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js +0 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/constants.d.ts +0 -2
- package/build/dex/uniswap-v3/constants.js +1 -8
- package/build/dex/uniswap-v3/constants.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/TickBitMap.d.ts +2 -2
- package/build/dex/uniswap-v3/contract-math/TickBitMap.js +8 -10
- package/build/dex/uniswap-v3/contract-math/TickBitMap.js.map +1 -1
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js +3 -3
- package/build/dex/uniswap-v3/contract-math/uniswap-v3-math.js.map +1 -1
- package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js +0 -1
- package/build/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.js.map +1 -1
- package/build/dex/uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream-pool.js +0 -1
- package/build/dex/uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream-pool.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +0 -1
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +1 -5
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/wusdm/config.js +0 -6
- package/build/dex/wusdm/config.js.map +1 -1
- package/build/generic-swap-transaction-builder.d.ts +1 -1
- package/build/generic-swap-transaction-builder.js +1 -6
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/build/implementations/local-paraswap-sdk.js +1 -1
- package/build/implementations/local-paraswap-sdk.js.map +1 -1
- package/package.json +3 -3
- package/scripts/run-dex-integration-v3.ts +4 -4
- package/src/abi/fluid-dex/resolver.abi.json +0 -30
- package/src/abi/m-token/WrappedM.abi.json +1708 -0
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-e2e.test.ts +32 -11
- package/src/dex/aave-v3-stata-v2/config.ts +0 -16
- package/src/dex/algebra/config.ts +1 -1
- package/src/dex/balancer-v2/balancer-v2-integration.test.ts +12 -11
- package/src/dex/balancer-v2/pools/gyro/GyroEPool.ts +1 -0
- package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +0 -130
- package/src/dex/balancer-v3/balancer-v3-events.test.ts +84 -157
- package/src/dex/balancer-v3/balancer-v3-integration.test.ts +202 -103
- package/src/dex/balancer-v3/balancer-v3-pool.ts +26 -85
- package/src/dex/balancer-v3/balancer-v3.ts +2 -43
- package/src/dex/balancer-v3/config.ts +0 -51
- package/src/dex/balancer-v3/getOnChainState.ts +4 -1
- package/src/dex/balancer-v3/getPoolsApi.ts +23 -42
- package/src/dex/balancer-v3/getTopPoolsApi.ts +2 -13
- package/src/dex/balancer-v3/types.ts +2 -4
- package/src/dex/cables/cables-e2e.test.ts +40 -40
- package/src/dex/cables/cables.ts +10 -37
- package/src/dex/fluid-dex/config.ts +2 -2
- package/src/dex/fluid-dex/constants.ts +1 -2
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +117 -61
- package/src/dex/fluid-dex/fluid-dex-liquidity-proxy.ts +0 -3
- package/src/dex/fluid-dex/fluid-dex.ts +94 -96
- package/src/dex/fluid-dex/types.ts +0 -3
- package/src/dex/index.ts +2 -0
- package/src/dex/m-token/config.ts +18 -0
- package/src/dex/m-token/m-token-e2e.test.ts +93 -0
- package/src/dex/m-token/m-token-integration.test.ts +199 -0
- package/src/dex/m-token/m-token.ts +167 -0
- package/src/dex/m-token/m-wrapped-m.ts +68 -0
- package/src/dex/m-token/types.ts +10 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-pool.ts +0 -1
- package/src/dex/uniswap-v3/constants.ts +0 -10
- package/src/dex/uniswap-v3/contract-math/TickBitMap.ts +9 -29
- package/src/dex/uniswap-v3/contract-math/uniswap-v3-math.ts +1 -3
- package/src/dex/uniswap-v3/forks/ramses-v2/ramses-v2-pool.ts +0 -1
- package/src/dex/uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream-pool.ts +0 -1
- package/src/dex/uniswap-v3/types.ts +0 -1
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +302 -647
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +1 -11
- package/src/dex/wusdm/config.ts +0 -7
- package/src/dex/wusdm/wusdm-e2e.test.ts +0 -20
- package/src/generic-swap-transaction-builder.ts +2 -10
- package/src/implementations/local-paraswap-sdk.ts +1 -1
- package/tests/constants-e2e.ts +8 -63
- package/tests/tenderly-simulation.ts +0 -3
- package/tests/utils-e2e.ts +7 -4
- package/src/abi/balancer-v3/directionalFeeHook.json +0 -684
- package/src/abi/balancer-v3/stableSurgeHook.json +0 -976
- package/src/dex/balancer-v3/balancer-hooks-events.test.ts +0 -166
- package/src/dex/balancer-v3/balancer-stableSurge.test.ts +0 -110
- package/src/dex/balancer-v3/balancer-test-helpers.ts +0 -199
- package/src/dex/balancer-v3/hooks/balancer-hook-event-subscriber.ts +0 -212
- package/src/dex/balancer-v3/hooks/directionalFeeHook.ts +0 -51
- package/src/dex/balancer-v3/hooks/loadHooksConfig.ts +0 -12
- package/src/dex/balancer-v3/hooks/stableSurgeHook.ts +0 -198
|
@@ -234,18 +234,29 @@ describe('AaveV3Stata E2E', () => {
|
|
|
234
234
|
// });
|
|
235
235
|
// });
|
|
236
236
|
|
|
237
|
-
describe('Arbitrum', () => {
|
|
237
|
+
describe.skip('Arbitrum', () => {
|
|
238
238
|
const network = Network.ARBITRUM;
|
|
239
239
|
|
|
240
240
|
const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [
|
|
241
241
|
[
|
|
242
242
|
{
|
|
243
|
-
name: '
|
|
244
|
-
amount: '
|
|
243
|
+
name: 'USDT',
|
|
244
|
+
amount: '100000',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'stataUSDT',
|
|
248
|
+
amount: '100000',
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
[
|
|
252
|
+
{
|
|
253
|
+
name: 'aaveUSDT',
|
|
254
|
+
amount: '100000',
|
|
255
|
+
skipBuy: true,
|
|
245
256
|
},
|
|
246
257
|
{
|
|
247
|
-
name: '
|
|
248
|
-
amount: '
|
|
258
|
+
name: 'stataUSDT',
|
|
259
|
+
amount: '100000',
|
|
249
260
|
},
|
|
250
261
|
],
|
|
251
262
|
];
|
|
@@ -263,7 +274,6 @@ describe('AaveV3Stata E2E', () => {
|
|
|
263
274
|
});
|
|
264
275
|
});
|
|
265
276
|
|
|
266
|
-
// no tokens yet deployed
|
|
267
277
|
describe.skip('Optimism', () => {
|
|
268
278
|
const network = Network.OPTIMISM;
|
|
269
279
|
|
|
@@ -304,18 +314,29 @@ describe('AaveV3Stata E2E', () => {
|
|
|
304
314
|
});
|
|
305
315
|
});
|
|
306
316
|
|
|
307
|
-
describe('Base', () => {
|
|
317
|
+
describe.skip('Base', () => {
|
|
308
318
|
const network = Network.BASE;
|
|
309
319
|
|
|
310
320
|
const pairs: { name: string; amount: string; skipBuy?: boolean }[][] = [
|
|
311
321
|
[
|
|
312
322
|
{
|
|
313
|
-
name: '
|
|
314
|
-
amount: '
|
|
323
|
+
name: 'USDC',
|
|
324
|
+
amount: '100000',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'stataUSDC',
|
|
328
|
+
amount: '100000',
|
|
315
329
|
},
|
|
330
|
+
],
|
|
331
|
+
[
|
|
316
332
|
{
|
|
317
|
-
name: '
|
|
318
|
-
amount: '
|
|
333
|
+
name: 'aaveUSDC',
|
|
334
|
+
amount: '100000',
|
|
335
|
+
skipBuy: true,
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'stataUSDC',
|
|
339
|
+
amount: '100000',
|
|
319
340
|
},
|
|
320
341
|
],
|
|
321
342
|
];
|
|
@@ -2,12 +2,9 @@ import { DexParams } from './types';
|
|
|
2
2
|
import { DexConfigMap } from '../../types';
|
|
3
3
|
import { Network } from '../../constants';
|
|
4
4
|
import {
|
|
5
|
-
AaveV3Arbitrum,
|
|
6
|
-
AaveV3Base,
|
|
7
5
|
AaveV3Ethereum,
|
|
8
6
|
AaveV3EthereumLido,
|
|
9
7
|
AaveV3Gnosis,
|
|
10
|
-
AaveV3Optimism,
|
|
11
8
|
} from '@bgd-labs/aave-address-book';
|
|
12
9
|
|
|
13
10
|
export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
@@ -23,18 +20,5 @@ export const AaveV3StataConfig: DexConfigMap<DexParams> = {
|
|
|
23
20
|
factoryAddresses: [AaveV3Gnosis.STATA_FACTORY],
|
|
24
21
|
pool: AaveV3Gnosis.POOL,
|
|
25
22
|
},
|
|
26
|
-
// Waiting for BalancerV3 to get released on Optimism
|
|
27
|
-
// [Network.OPTIMISM]: {
|
|
28
|
-
// factoryAddresses: [AaveV3Optimism.STATA_FACTORY],
|
|
29
|
-
// pool: AaveV3Optimism.POOL,
|
|
30
|
-
// },
|
|
31
|
-
[Network.ARBITRUM]: {
|
|
32
|
-
factoryAddresses: [AaveV3Arbitrum.STATA_FACTORY],
|
|
33
|
-
pool: AaveV3Arbitrum.POOL,
|
|
34
|
-
},
|
|
35
|
-
[Network.BASE]: {
|
|
36
|
-
factoryAddresses: [AaveV3Base.STATA_FACTORY],
|
|
37
|
-
pool: AaveV3Base.POOL,
|
|
38
|
-
},
|
|
39
23
|
},
|
|
40
24
|
};
|
|
@@ -95,7 +95,7 @@ export const AlgebraConfig: DexConfigMap<DexParams> = {
|
|
|
95
95
|
initRetryFrequency: 10,
|
|
96
96
|
// AlgebraStateMulticall
|
|
97
97
|
algebraStateMulticall: '0x49C46f7f88110ccA234ef27Cd664510f7bbF5998',
|
|
98
|
-
subgraphURL: '
|
|
98
|
+
subgraphURL: 'AAA1vYjxwFHzbt6qKwLHNcDSASyr1J1xVViDH8gTMFMR',
|
|
99
99
|
uniswapMulticall: '0x4dfa9a980efE4802E969AC33968E3d6E59B8a19e',
|
|
100
100
|
deployer: '0xC1b576AC6Ec749d5Ace1787bF9Ec6340908ddB47',
|
|
101
101
|
version: 'v1.9-bidirectional-fee',
|
|
@@ -697,25 +697,29 @@ describe('BalancerV2', function () {
|
|
|
697
697
|
});
|
|
698
698
|
|
|
699
699
|
describe('WETH / USDC', () => {
|
|
700
|
-
const gyroEAddr = '
|
|
700
|
+
const gyroEAddr = '0x4c42b5057a8663e2b1ac21685d1502c937a03817';
|
|
701
701
|
|
|
702
702
|
it('SELL WETH -> USDC getPoolIdentifiers and getPricesVolume', async function () {
|
|
703
703
|
const network = Network.BASE;
|
|
704
704
|
|
|
705
705
|
const dexHelper = new DummyDexHelper(network);
|
|
706
706
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
707
|
-
// const blocknumber =
|
|
707
|
+
// const blocknumber = 19425305;
|
|
708
708
|
const balancerV2 = new BalancerV2(network, dexKey, dexHelper);
|
|
709
709
|
const tokens = Tokens[network];
|
|
710
710
|
|
|
711
|
-
console.log('BLOCK NUMBER: ', blocknumber);
|
|
712
|
-
|
|
713
711
|
const amounts = [
|
|
714
712
|
0n,
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
713
|
+
BI_POWS[18],
|
|
714
|
+
2n * BI_POWS[18],
|
|
715
|
+
3n * BI_POWS[18],
|
|
716
|
+
4n * BI_POWS[18],
|
|
717
|
+
5n * BI_POWS[18],
|
|
718
|
+
6n * BI_POWS[18],
|
|
719
|
+
7n * BI_POWS[18],
|
|
720
|
+
8n * BI_POWS[18],
|
|
721
|
+
9n * BI_POWS[18],
|
|
722
|
+
10n * BI_POWS[18],
|
|
719
723
|
];
|
|
720
724
|
|
|
721
725
|
await balancerV2.initializePricing(blocknumber);
|
|
@@ -750,9 +754,6 @@ describe('BalancerV2', function () {
|
|
|
750
754
|
const isPoolPrice = poolPrices!.find(price =>
|
|
751
755
|
price.data.poolId.includes(gyroEAddr),
|
|
752
756
|
);
|
|
753
|
-
|
|
754
|
-
console.log('isPoolPrice: ', isPoolPrice);
|
|
755
|
-
|
|
756
757
|
expect(isPoolPrice).toBeDefined();
|
|
757
758
|
|
|
758
759
|
const onChainPrices = await getOnChainPricingForWeightedPool(
|
|
@@ -296,134 +296,4 @@ describe('BalancerV3 E2E', () => {
|
|
|
296
296
|
);
|
|
297
297
|
});
|
|
298
298
|
});
|
|
299
|
-
|
|
300
|
-
describe('Arbitrum', () => {
|
|
301
|
-
const network = Network.ARBITRUM;
|
|
302
|
-
|
|
303
|
-
describe('Stable Path', () => {
|
|
304
|
-
const tokenASymbol: string = 'wstETH';
|
|
305
|
-
const tokenBSymbol: string = 'WETH';
|
|
306
|
-
|
|
307
|
-
const tokenAAmount: string = '10000000000000';
|
|
308
|
-
const tokenBAmount: string = '10000000000000';
|
|
309
|
-
const nativeTokenAmount = '0';
|
|
310
|
-
|
|
311
|
-
testForNetwork(
|
|
312
|
-
network,
|
|
313
|
-
dexKey,
|
|
314
|
-
tokenASymbol,
|
|
315
|
-
tokenBSymbol,
|
|
316
|
-
tokenAAmount,
|
|
317
|
-
tokenBAmount,
|
|
318
|
-
nativeTokenAmount,
|
|
319
|
-
false,
|
|
320
|
-
);
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
// No holders for tokens
|
|
324
|
-
// describe('Boosted Path', () => {
|
|
325
|
-
// const tokenASymbol: string = 'waArbWETH';
|
|
326
|
-
// const tokenBSymbol: string = 'waArbwstETH';
|
|
327
|
-
//
|
|
328
|
-
// const tokenAAmount: string = '10000000000000';
|
|
329
|
-
// const tokenBAmount: string = '10000000000000';
|
|
330
|
-
// const nativeTokenAmount = '0';
|
|
331
|
-
//
|
|
332
|
-
// testForNetwork(
|
|
333
|
-
// network,
|
|
334
|
-
// dexKey,
|
|
335
|
-
// tokenASymbol,
|
|
336
|
-
// tokenBSymbol,
|
|
337
|
-
// tokenAAmount,
|
|
338
|
-
// tokenBAmount,
|
|
339
|
-
// nativeTokenAmount,
|
|
340
|
-
// false,
|
|
341
|
-
// );
|
|
342
|
-
// });
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
describe('Base', () => {
|
|
346
|
-
const network = Network.BASE;
|
|
347
|
-
|
|
348
|
-
describe('Stable Path', () => {
|
|
349
|
-
const tokenASymbol: string = 'wstETH';
|
|
350
|
-
const tokenBSymbol: string = 'WETH';
|
|
351
|
-
|
|
352
|
-
const tokenAAmount: string = '100000000000000';
|
|
353
|
-
const tokenBAmount: string = '100000000000000';
|
|
354
|
-
const nativeTokenAmount = '0';
|
|
355
|
-
|
|
356
|
-
testForNetwork(
|
|
357
|
-
network,
|
|
358
|
-
dexKey,
|
|
359
|
-
tokenASymbol,
|
|
360
|
-
tokenBSymbol,
|
|
361
|
-
tokenAAmount,
|
|
362
|
-
tokenBAmount,
|
|
363
|
-
nativeTokenAmount,
|
|
364
|
-
false,
|
|
365
|
-
);
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
describe('Boosted Path', () => {
|
|
369
|
-
const tokenASymbol: string = 'sUSDS';
|
|
370
|
-
const tokenBSymbol: string = 'smUSDC';
|
|
371
|
-
|
|
372
|
-
const tokenAAmount: string = '10000000000000';
|
|
373
|
-
const tokenBAmount: string = '10000000000000';
|
|
374
|
-
const nativeTokenAmount = '0';
|
|
375
|
-
|
|
376
|
-
testForNetwork(
|
|
377
|
-
network,
|
|
378
|
-
dexKey,
|
|
379
|
-
tokenASymbol,
|
|
380
|
-
tokenBSymbol,
|
|
381
|
-
tokenAAmount,
|
|
382
|
-
tokenBAmount,
|
|
383
|
-
nativeTokenAmount,
|
|
384
|
-
false,
|
|
385
|
-
);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
describe('StableSurge Hook', () => {
|
|
389
|
-
const tokenASymbol: string = 'waBasGHO';
|
|
390
|
-
const tokenBSymbol: string = 'waBasUSDC';
|
|
391
|
-
|
|
392
|
-
const tokenAAmount: string = '500000000000000000';
|
|
393
|
-
const tokenBAmount: string = '500000';
|
|
394
|
-
const nativeTokenAmount = '0';
|
|
395
|
-
|
|
396
|
-
testForNetwork(
|
|
397
|
-
network,
|
|
398
|
-
dexKey,
|
|
399
|
-
tokenASymbol,
|
|
400
|
-
tokenBSymbol,
|
|
401
|
-
tokenAAmount,
|
|
402
|
-
tokenBAmount,
|
|
403
|
-
nativeTokenAmount,
|
|
404
|
-
false,
|
|
405
|
-
);
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// No holders for waBasWETH
|
|
409
|
-
// describe('Boosted Path', () => {
|
|
410
|
-
// const tokenASymbol: string = 'waBaswstETH';
|
|
411
|
-
// const tokenBSymbol: string = 'waBasWETH';
|
|
412
|
-
//
|
|
413
|
-
// const tokenAAmount: string = '10000000000000';
|
|
414
|
-
// const tokenBAmount: string = '10000000000000';
|
|
415
|
-
// const nativeTokenAmount = '0';
|
|
416
|
-
//
|
|
417
|
-
// testForNetwork(
|
|
418
|
-
// network,
|
|
419
|
-
// dexKey,
|
|
420
|
-
// tokenASymbol,
|
|
421
|
-
// tokenBSymbol,
|
|
422
|
-
// tokenAAmount,
|
|
423
|
-
// tokenBAmount,
|
|
424
|
-
// nativeTokenAmount,
|
|
425
|
-
// false,
|
|
426
|
-
// );
|
|
427
|
-
// });
|
|
428
|
-
});
|
|
429
299
|
});
|
|
@@ -129,168 +129,95 @@ type EventData = { blockNumbers: number[]; poolAddress: string[] };
|
|
|
129
129
|
|
|
130
130
|
describe('BalancerV3 EventPool', function () {
|
|
131
131
|
const dexKey = 'BalancerV3';
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
blockNumbers: [7170937],
|
|
146
|
-
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
147
|
-
},
|
|
148
|
-
// https://sepolia.etherscan.io/tx/0xc1596e26d51104b9236a0debc3e1946b30b82f92b8331639ad6f6aea2ff2decc
|
|
149
|
-
LiquidityRemoved: {
|
|
150
|
-
blockNumbers: [7170957],
|
|
151
|
-
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
152
|
-
},
|
|
153
|
-
// https://sepolia.etherscan.io/tx/0x78d18503c2dd4458c94ec916b10c088bb4e8b90059676d00dbcec83f763d8c0e
|
|
154
|
-
Swap: {
|
|
155
|
-
blockNumbers: [7175721],
|
|
156
|
-
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
157
|
-
},
|
|
158
|
-
// 7170034, AmpUpdateStarted, https://eth-sepolia.blockscout.com/tx/0xfbe2e53d9cede1dc900100a1d6e809a89d909746ac7b8cc011e93227af8dda8b?tab=logs
|
|
159
|
-
// 7170069, AmpUpdateStopped, https://eth-sepolia.blockscout.com/tx/0x2ee2e1d5980013fdf1cf9c3789e0321fb598c2412db8ee8057fcfaffd1c792ab?tab=logs
|
|
160
|
-
VaultAuxiliary: {
|
|
161
|
-
blockNumbers: [7170034, 7170069],
|
|
162
|
-
poolAddress: [
|
|
163
|
-
'0xD63dB0B88dca565633fB8d70a70b9b8093d34A7E',
|
|
164
|
-
'0xD63dB0B88dca565633fB8d70a70b9b8093d34A7E',
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
// https://sepolia.etherscan.io/tx/0x71f9879485f4e4cf97aa42381988ffe277f05a872d6b507cfa007cec1239a3f8#eventlog
|
|
168
|
-
SwapFeePercentageChanged: {
|
|
169
|
-
blockNumbers: [7206571],
|
|
170
|
-
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
171
|
-
},
|
|
172
|
-
// https://sepolia.etherscan.io/tx/0xaf232ca2df59ba5fad38d74e9b54ec2ae1ad2e6abca8348f107cf3fd94c787c7#eventlog
|
|
173
|
-
// Should remove pool from state as its paused and no longer supports swaps
|
|
174
|
-
PoolPausedStateChanged: {
|
|
175
|
-
blockNumbers: [7206586],
|
|
176
|
-
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
177
|
-
},
|
|
178
|
-
// https://sepolia.etherscan.io/tx/0xa23dc10bd0fbed7ffffe867766d9b0d7670ca4a0bc352669f547bc7775644349#eventlog
|
|
179
|
-
AggregateSwapFeePercentageChanged: {
|
|
180
|
-
blockNumbers: [7206701],
|
|
181
|
-
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
182
|
-
},
|
|
132
|
+
const network = Network.SEPOLIA;
|
|
133
|
+
const dexHelper = new DummyDexHelper(network);
|
|
134
|
+
const logger = dexHelper.getLogger(dexKey);
|
|
135
|
+
let balancerV3Pool: BalancerV3EventPool;
|
|
136
|
+
|
|
137
|
+
// vault -> EventMappings
|
|
138
|
+
// TODO once we have a new test deployment add tests for: AggregateSwapFeePercentageChanged, SwapFeePercentageChanged, PoolPausedStateChanged
|
|
139
|
+
const eventsToTest: Record<Address, EventMappings> = {
|
|
140
|
+
[BalancerV3Config.BalancerV3[network].vaultAddress]: {
|
|
141
|
+
// https://eth-sepolia.blockscout.com/tx/0xc417d38ad6e21250c9ddded37680b40f0991cfd3f8ae2d8b5800507a58d48c44
|
|
142
|
+
LiquidityAdded: {
|
|
143
|
+
blockNumbers: [7170937],
|
|
144
|
+
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
183
145
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
dexKey,
|
|
189
|
-
network,
|
|
190
|
-
dexHelper,
|
|
191
|
-
logger,
|
|
192
|
-
);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
Object.entries(eventsToTest).forEach(
|
|
196
|
-
([vaultAddress, events]: [string, EventMappings]) => {
|
|
197
|
-
describe(`Events for Vault: ${vaultAddress}`, () => {
|
|
198
|
-
Object.entries(events).forEach(
|
|
199
|
-
([eventName, eventData]: [string, EventData]) => {
|
|
200
|
-
describe(`${eventName}`, () => {
|
|
201
|
-
eventData.blockNumbers.forEach((blockNumber: number, i) => {
|
|
202
|
-
it(`Pool: ${eventData.poolAddress[i]} State after ${blockNumber}`, async function () {
|
|
203
|
-
await testEventSubscriber(
|
|
204
|
-
balancerV3Pool,
|
|
205
|
-
balancerV3Pool.addressesSubscribed,
|
|
206
|
-
(_blockNumber: number) =>
|
|
207
|
-
fetchPoolState(
|
|
208
|
-
balancerV3Pool,
|
|
209
|
-
_blockNumber,
|
|
210
|
-
eventData.poolAddress[i],
|
|
211
|
-
),
|
|
212
|
-
blockNumber,
|
|
213
|
-
`${dexKey}_${vaultAddress}`,
|
|
214
|
-
dexHelper.provider,
|
|
215
|
-
stateCompare,
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
},
|
|
221
|
-
);
|
|
222
|
-
});
|
|
146
|
+
// https://sepolia.etherscan.io/tx/0xc1596e26d51104b9236a0debc3e1946b30b82f92b8331639ad6f6aea2ff2decc
|
|
147
|
+
LiquidityRemoved: {
|
|
148
|
+
blockNumbers: [7170957],
|
|
149
|
+
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
223
150
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const network = Network.MAINNET;
|
|
229
|
-
const dexHelper = new DummyDexHelper(network);
|
|
230
|
-
const logger = dexHelper.getLogger(dexKey);
|
|
231
|
-
let balancerV3Pool: BalancerV3EventPool;
|
|
232
|
-
|
|
233
|
-
// vault -> EventMappings
|
|
234
|
-
// TODO once we have a new test deployment add tests for: AggregateSwapFeePercentageChanged, SwapFeePercentageChanged, PoolPausedStateChanged
|
|
235
|
-
const eventsToTest: Record<Address, EventMappings> = {
|
|
236
|
-
[BalancerV3Config.BalancerV3[network].vaultAddress]: {
|
|
237
|
-
LiquidityAdded: {
|
|
238
|
-
blockNumbers: [21774068],
|
|
239
|
-
poolAddress: ['0x8523bcadcda4bd329435940dcc49a7c4c0a14d94'],
|
|
240
|
-
},
|
|
241
|
-
LiquidityRemoved: {
|
|
242
|
-
blockNumbers: [21788910],
|
|
243
|
-
poolAddress: ['0x8523bcadcda4bd329435940dcc49a7c4c0a14d94'],
|
|
244
|
-
},
|
|
245
|
-
Swap: {
|
|
246
|
-
blockNumbers: [21788638, 21791514, 21791514],
|
|
247
|
-
poolAddress: [
|
|
248
|
-
'0x8523bcadcda4bd329435940dcc49a7c4c0a14d94',
|
|
249
|
-
'0x8523bcadcda4bd329435940dcc49a7c4c0a14d94',
|
|
250
|
-
'0x8523bcadcda4bd329435940dcc49a7c4c0a14d94',
|
|
251
|
-
],
|
|
252
|
-
},
|
|
151
|
+
// https://sepolia.etherscan.io/tx/0x78d18503c2dd4458c94ec916b10c088bb4e8b90059676d00dbcec83f763d8c0e
|
|
152
|
+
Swap: {
|
|
153
|
+
blockNumbers: [7175721],
|
|
154
|
+
poolAddress: ['0x2ff3b96e0057a1f25f1d62ab800554ccdb268ab8'],
|
|
253
155
|
},
|
|
254
|
-
|
|
156
|
+
// 7170034, AmpUpdateStarted, https://eth-sepolia.blockscout.com/tx/0xfbe2e53d9cede1dc900100a1d6e809a89d909746ac7b8cc011e93227af8dda8b?tab=logs
|
|
157
|
+
// 7170069, AmpUpdateStopped, https://eth-sepolia.blockscout.com/tx/0x2ee2e1d5980013fdf1cf9c3789e0321fb598c2412db8ee8057fcfaffd1c792ab?tab=logs
|
|
158
|
+
VaultAuxiliary: {
|
|
159
|
+
blockNumbers: [7170034, 7170069],
|
|
160
|
+
poolAddress: [
|
|
161
|
+
'0xD63dB0B88dca565633fB8d70a70b9b8093d34A7E',
|
|
162
|
+
'0xD63dB0B88dca565633fB8d70a70b9b8093d34A7E',
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
// https://sepolia.etherscan.io/tx/0x71f9879485f4e4cf97aa42381988ffe277f05a872d6b507cfa007cec1239a3f8#eventlog
|
|
166
|
+
SwapFeePercentageChanged: {
|
|
167
|
+
blockNumbers: [7206571],
|
|
168
|
+
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
169
|
+
},
|
|
170
|
+
// https://sepolia.etherscan.io/tx/0xaf232ca2df59ba5fad38d74e9b54ec2ae1ad2e6abca8348f107cf3fd94c787c7#eventlog
|
|
171
|
+
// Should remove pool from state as its paused and no longer supports swaps
|
|
172
|
+
PoolPausedStateChanged: {
|
|
173
|
+
blockNumbers: [7206586],
|
|
174
|
+
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
175
|
+
},
|
|
176
|
+
// https://sepolia.etherscan.io/tx/0xa23dc10bd0fbed7ffffe867766d9b0d7670ca4a0bc352669f547bc7775644349#eventlog
|
|
177
|
+
AggregateSwapFeePercentageChanged: {
|
|
178
|
+
blockNumbers: [7206701],
|
|
179
|
+
poolAddress: ['0xe69b70a86A4e1fD33dA95693A1aE12Be1c26C8ea'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
255
183
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
184
|
+
beforeEach(async () => {
|
|
185
|
+
balancerV3Pool = new BalancerV3EventPool(
|
|
186
|
+
dexKey,
|
|
187
|
+
network,
|
|
188
|
+
dexHelper,
|
|
189
|
+
logger,
|
|
190
|
+
);
|
|
191
|
+
});
|
|
264
192
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
});
|
|
193
|
+
Object.entries(eventsToTest).forEach(
|
|
194
|
+
([vaultAddress, events]: [string, EventMappings]) => {
|
|
195
|
+
describe(`Events for Vault: ${vaultAddress}`, () => {
|
|
196
|
+
Object.entries(events).forEach(
|
|
197
|
+
([eventName, eventData]: [string, EventData]) => {
|
|
198
|
+
describe(`${eventName}`, () => {
|
|
199
|
+
eventData.blockNumbers.forEach((blockNumber: number, i) => {
|
|
200
|
+
it(`Pool: ${eventData.poolAddress[i]} State after ${blockNumber}`, async function () {
|
|
201
|
+
await testEventSubscriber(
|
|
202
|
+
balancerV3Pool,
|
|
203
|
+
balancerV3Pool.addressesSubscribed,
|
|
204
|
+
(_blockNumber: number) =>
|
|
205
|
+
fetchPoolState(
|
|
206
|
+
balancerV3Pool,
|
|
207
|
+
_blockNumber,
|
|
208
|
+
eventData.poolAddress[i],
|
|
209
|
+
),
|
|
210
|
+
blockNumber,
|
|
211
|
+
`${dexKey}_${vaultAddress}`,
|
|
212
|
+
dexHelper.provider,
|
|
213
|
+
stateCompare,
|
|
214
|
+
);
|
|
288
215
|
});
|
|
289
216
|
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
);
|
|
296
223
|
});
|