@paraswap/dex-lib 2.30.2-chronos-v3 → 2.30.2
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/build/dex/balancer-v2/balancer-v2.js +0 -2
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/optimizer.js +38 -51
- package/build/dex/balancer-v2/optimizer.js.map +1 -1
- package/build/dex/balancer-v2/types.d.ts +0 -4
- package/build/dex/balancer-v2/types.js.map +1 -1
- package/build/dex/curve-v1-factory/config.js +17 -9
- package/build/dex/curve-v1-factory/config.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +1 -1
- package/build/dex/curve-v1-factory/curve-v1-factory.js +192 -177
- package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js +4 -1
- package/build/dex/curve-v1-factory/curve-v1-pool-manager.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_rates.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/_xp_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js +61 -14
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js +10 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/constants.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_mem.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y.js.map +1 -1
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js +1 -0
- package/build/dex/curve-v1-factory/price-handlers/functions/get_y_D.js.map +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.d.ts +1 -1
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js +2 -2
- package/build/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.js.map +1 -1
- package/build/dex/curve-v1-factory/types.d.ts +4 -1
- package/build/dex/curve-v1-factory/types.js +1 -0
- package/build/dex/curve-v1-factory/types.js.map +1 -1
- package/build/dex/solidly/forks-override/ramses.js +20 -8
- package/build/dex/solidly/forks-override/ramses.js.map +1 -1
- package/build/dex/solidly/solidly.js +1 -1
- package/build/dex/{ramses-v2 → test-dex}/config.d.ts +1 -1
- package/build/dex/test-dex/config.js +15 -0
- package/build/dex/test-dex/config.js.map +1 -0
- package/build/dex/test-dex/test-dex-pool.d.ts +39 -0
- package/build/dex/test-dex/test-dex-pool.js +63 -0
- package/build/dex/test-dex/test-dex-pool.js.map +1 -0
- package/build/dex/test-dex/test-dex.d.ts +37 -0
- package/build/dex/test-dex/test-dex.js +126 -0
- package/build/dex/test-dex/test-dex.js.map +1 -0
- package/build/dex/test-dex/types.d.ts +6 -0
- package/build/dex/{pancakeswap-v3 → test-dex}/types.js.map +1 -1
- package/build/dex/uniswap-v3/config.js +0 -14
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +16 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js +137 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +1 -0
- package/package.json +1 -2
- package/scripts/dex-integration.ts +1 -1
- package/src/dex/balancer-v2/balancer-v2.ts +0 -2
- package/src/dex/balancer-v2/optimizer.ts +49 -62
- package/src/dex/balancer-v2/types.ts +0 -4
- package/src/dex/curve-v1-factory/config.ts +17 -9
- package/src/dex/curve-v1-factory/curve-v1-factory-e2e.test.ts +19 -0
- package/src/dex/curve-v1-factory/curve-v1-factory-integration.test.ts +108 -45
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +415 -367
- package/src/dex/curve-v1-factory/curve-v1-pool-manager.ts +4 -1
- package/src/dex/curve-v1-factory/price-handlers/functions/_calc_withdraw_one_coin.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_dynamic_fee.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_rates.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/_xp_mem.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_token_amount.ts +71 -13
- package/src/dex/curve-v1-factory/price-handlers/functions/calc_withdraw_one_coin.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/constants.ts +11 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D.ts +2 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_mem.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_D_precisions.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_dy_underlying.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y.ts +1 -0
- package/src/dex/curve-v1-factory/price-handlers/functions/get_y_D.ts +1 -0
- package/src/dex/curve-v1-factory/state-polling-pools/factory-pool-polling.ts +2 -1
- package/src/dex/curve-v1-factory/types.ts +3 -1
- package/src/dex/solidly/forks-override/ramses.ts +105 -76
- package/src/dex/solidly/solidly.ts +1 -1
- package/src/dex/uniswap-v3/config.ts +0 -16
- package/src/dex/uniswap-v3/types.ts +4 -2
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +50 -133
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +2 -150
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +5 -2
- package/src/dex/uniswap-v3/uniswap-v3.ts +4 -3
- package/tests/constants-e2e.ts +10 -0
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/vcs.xml +0 -6
- package/build/abi/algebra/AlgebraPool.abi.json +0 -727
- package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
- package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
- package/build/abi/wBETH.json +0 -1527
- package/build/dex/algebra/algebra-pool.d.ts +0 -46
- package/build/dex/algebra/algebra-pool.js +0 -336
- package/build/dex/algebra/algebra-pool.js.map +0 -1
- package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
- package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
- package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
- package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
- package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
- package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- package/build/dex/ramses-v2/config.js +0 -28
- package/build/dex/ramses-v2/config.js.map +0 -1
- package/build/dex/ramses-v2/constants.d.ts +0 -28
- package/build/dex/ramses-v2/constants.js +0 -35
- package/build/dex/ramses-v2/constants.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
- package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
- package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
- package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
- package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
- package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
- package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
- package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
- package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/utils.js +0 -16
- package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
- package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
- package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
- package/build/dex/ramses-v2/ramses-v2.js +0 -690
- package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
- package/build/dex/ramses-v2/types.d.ts +0 -154
- package/build/dex/ramses-v2/types.js +0 -9
- package/build/dex/ramses-v2/types.js.map +0 -1
- package/build/dex/ramses-v2/utils.d.ts +0 -6
- package/build/dex/ramses-v2/utils.js +0 -71
- package/build/dex/ramses-v2/utils.js.map +0 -1
- /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
|
@@ -12,7 +12,6 @@ import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
|
12
12
|
import { generateConfig } from '../../config';
|
|
13
13
|
|
|
14
14
|
describe('UniswapV3 E2E', () => {
|
|
15
|
-
|
|
16
15
|
describe('UniswapV3', () => {
|
|
17
16
|
const dexKey = 'UniswapV3';
|
|
18
17
|
|
|
@@ -324,52 +323,57 @@ describe('UniswapV3 E2E', () => {
|
|
|
324
323
|
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
325
324
|
]);
|
|
326
325
|
|
|
327
|
-
const pairs: { name: string; sellAmount: string; buyAmount: string }[][] =
|
|
328
|
-
[
|
|
329
|
-
{
|
|
330
|
-
name: 'AVAX',
|
|
331
|
-
sellAmount: '1000000000000000000',
|
|
332
|
-
buyAmount: '500000',
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'USDT',
|
|
336
|
-
sellAmount: '1000000',
|
|
337
|
-
buyAmount: '10000000000000000000',
|
|
338
|
-
},
|
|
339
|
-
],
|
|
340
|
-
[
|
|
341
|
-
{
|
|
342
|
-
name: 'AVAX',
|
|
343
|
-
sellAmount: '1000000000000000000',
|
|
344
|
-
buyAmount: '500000',
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
name: 'USDC',
|
|
348
|
-
sellAmount: '1000000',
|
|
349
|
-
buyAmount: '1000000000000000000',
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
[
|
|
353
|
-
{
|
|
354
|
-
name: 'WAVAX',
|
|
355
|
-
sellAmount: '1000000000000000000',
|
|
356
|
-
buyAmount: '500000',
|
|
357
|
-
},
|
|
358
|
-
{ name: 'USDC', sellAmount: '1000000', buyAmount: '20000000000000000' },
|
|
359
|
-
],
|
|
326
|
+
const pairs: { name: string; sellAmount: string; buyAmount: string }[][] =
|
|
360
327
|
[
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
328
|
+
[
|
|
329
|
+
{
|
|
330
|
+
name: 'AVAX',
|
|
331
|
+
sellAmount: '1000000000000000000',
|
|
332
|
+
buyAmount: '500000',
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: 'USDT',
|
|
336
|
+
sellAmount: '1000000',
|
|
337
|
+
buyAmount: '10000000000000000000',
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
[
|
|
341
|
+
{
|
|
342
|
+
name: 'AVAX',
|
|
343
|
+
sellAmount: '1000000000000000000',
|
|
344
|
+
buyAmount: '500000',
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'USDC',
|
|
348
|
+
sellAmount: '1000000',
|
|
349
|
+
buyAmount: '1000000000000000000',
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
[
|
|
353
|
+
{
|
|
354
|
+
name: 'WAVAX',
|
|
355
|
+
sellAmount: '1000000000000000000',
|
|
356
|
+
buyAmount: '500000',
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: 'USDC',
|
|
360
|
+
sellAmount: '1000000',
|
|
361
|
+
buyAmount: '20000000000000000',
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
[
|
|
365
|
+
{
|
|
366
|
+
name: 'WAVAX',
|
|
367
|
+
sellAmount: '1000000000000000000',
|
|
368
|
+
buyAmount: '10000000',
|
|
369
|
+
},
|
|
370
|
+
{ name: 'USDT', sellAmount: '1000000', buyAmount: '2000000000000' },
|
|
371
|
+
],
|
|
372
|
+
[
|
|
373
|
+
{ name: 'USDC', sellAmount: '1000000', buyAmount: '100000000' },
|
|
374
|
+
{ name: 'USDT', sellAmount: '100000000', buyAmount: '100000000' },
|
|
375
|
+
],
|
|
376
|
+
];
|
|
373
377
|
|
|
374
378
|
sideToContractMethods.forEach((contractMethods, side) =>
|
|
375
379
|
describe(`${side}`, () => {
|
|
@@ -501,91 +505,4 @@ describe('UniswapV3 E2E', () => {
|
|
|
501
505
|
);
|
|
502
506
|
});
|
|
503
507
|
});
|
|
504
|
-
|
|
505
|
-
describe('ChronosV3', () => {
|
|
506
|
-
const dexKey = 'ChronosV3';
|
|
507
|
-
describe('Arbitrum', () => {
|
|
508
|
-
const network = Network.ARBITRUM;
|
|
509
|
-
const tokens = Tokens[network];
|
|
510
|
-
const holders = Holders[network];
|
|
511
|
-
const provider = new StaticJsonRpcProvider(
|
|
512
|
-
generateConfig(network).privateHttpProvider,
|
|
513
|
-
network,
|
|
514
|
-
);
|
|
515
|
-
|
|
516
|
-
const tokenASymbol: string = 'USDCe';
|
|
517
|
-
const tokenBSymbol: string = 'USDT';
|
|
518
|
-
const nativeTokenSymbol = NativeTokenSymbols[network];
|
|
519
|
-
|
|
520
|
-
const tokenAAmount: string = '2000000';
|
|
521
|
-
const tokenBAmount: string = '2000000';
|
|
522
|
-
const nativeTokenAmount = '100000000000000000';
|
|
523
|
-
|
|
524
|
-
const sideToContractMethods = new Map([
|
|
525
|
-
[
|
|
526
|
-
SwapSide.SELL,
|
|
527
|
-
[
|
|
528
|
-
ContractMethod.simpleSwap,
|
|
529
|
-
ContractMethod.multiSwap,
|
|
530
|
-
ContractMethod.megaSwap,
|
|
531
|
-
ContractMethod.directUniV3Swap,
|
|
532
|
-
],
|
|
533
|
-
],
|
|
534
|
-
[
|
|
535
|
-
SwapSide.BUY,
|
|
536
|
-
[
|
|
537
|
-
ContractMethod.simpleBuy,
|
|
538
|
-
ContractMethod.buy,
|
|
539
|
-
ContractMethod.directUniV3Buy,
|
|
540
|
-
],
|
|
541
|
-
],
|
|
542
|
-
]);
|
|
543
|
-
|
|
544
|
-
sideToContractMethods.forEach((contractMethods, side) =>
|
|
545
|
-
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
546
|
-
describe(`${contractMethod}`, () => {
|
|
547
|
-
it(`${network} ${side} ${contractMethod} ${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
|
|
548
|
-
await testE2E(
|
|
549
|
-
tokens[nativeTokenSymbol],
|
|
550
|
-
tokens[tokenASymbol],
|
|
551
|
-
holders[nativeTokenSymbol],
|
|
552
|
-
side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
|
|
553
|
-
side,
|
|
554
|
-
dexKey,
|
|
555
|
-
contractMethod,
|
|
556
|
-
network,
|
|
557
|
-
provider,
|
|
558
|
-
);
|
|
559
|
-
});
|
|
560
|
-
it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
|
|
561
|
-
await testE2E(
|
|
562
|
-
tokens[tokenASymbol],
|
|
563
|
-
tokens[nativeTokenSymbol],
|
|
564
|
-
holders[tokenASymbol],
|
|
565
|
-
side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
|
|
566
|
-
side,
|
|
567
|
-
dexKey,
|
|
568
|
-
contractMethod,
|
|
569
|
-
network,
|
|
570
|
-
provider,
|
|
571
|
-
);
|
|
572
|
-
});
|
|
573
|
-
it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
574
|
-
await testE2E(
|
|
575
|
-
tokens[tokenASymbol],
|
|
576
|
-
tokens[tokenBSymbol],
|
|
577
|
-
holders[tokenASymbol],
|
|
578
|
-
side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
|
|
579
|
-
side,
|
|
580
|
-
dexKey,
|
|
581
|
-
contractMethod,
|
|
582
|
-
network,
|
|
583
|
-
provider,
|
|
584
|
-
);
|
|
585
|
-
});
|
|
586
|
-
});
|
|
587
|
-
}),
|
|
588
|
-
);
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
508
|
});
|
|
@@ -28,7 +28,6 @@ const amounts = [
|
|
|
28
28
|
|
|
29
29
|
const amountsBuy = [0n, 1n * BI_POWS[18], 2n * BI_POWS[18], 3n * BI_POWS[18]];
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
const quoterIface = new Interface(UniswapV3QuoterV2ABI);
|
|
33
32
|
|
|
34
33
|
function getReaderCalldata(
|
|
@@ -43,13 +42,7 @@ function getReaderCalldata(
|
|
|
43
42
|
return amounts.map(amount => ({
|
|
44
43
|
target: exchangeAddress,
|
|
45
44
|
callData: readerIface.encodeFunctionData(funcName, [
|
|
46
|
-
[
|
|
47
|
-
tokenIn,
|
|
48
|
-
tokenOut,
|
|
49
|
-
amount.toString(),
|
|
50
|
-
fee.toString(),
|
|
51
|
-
0,
|
|
52
|
-
]
|
|
45
|
+
[tokenIn, tokenOut, amount.toString(), fee.toString(), 0],
|
|
53
46
|
]),
|
|
54
47
|
}));
|
|
55
48
|
}
|
|
@@ -499,15 +492,10 @@ describe('RamsesV2', () => {
|
|
|
499
492
|
beforeEach(async () => {
|
|
500
493
|
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
501
494
|
uniswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
502
|
-
uniswapV3Mainnet = new UniswapV3(
|
|
503
|
-
Network.ARBITRUM,
|
|
504
|
-
dexKey,
|
|
505
|
-
dexHelper,
|
|
506
|
-
);
|
|
495
|
+
uniswapV3Mainnet = new UniswapV3(Network.ARBITRUM, dexKey, dexHelper);
|
|
507
496
|
});
|
|
508
497
|
|
|
509
498
|
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
510
|
-
|
|
511
499
|
const amounts = [
|
|
512
500
|
0n,
|
|
513
501
|
6000000n,
|
|
@@ -566,7 +554,6 @@ describe('RamsesV2', () => {
|
|
|
566
554
|
});
|
|
567
555
|
|
|
568
556
|
it('getPoolIdentifiers and getPricesVolume BUY', async function () {
|
|
569
|
-
|
|
570
557
|
const amounts = [
|
|
571
558
|
0n,
|
|
572
559
|
6000000n,
|
|
@@ -624,138 +611,3 @@ describe('RamsesV2', () => {
|
|
|
624
611
|
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
625
612
|
});
|
|
626
613
|
});
|
|
627
|
-
|
|
628
|
-
describe('ChronosV3', () => {
|
|
629
|
-
const dexKey = 'ChronosV3';
|
|
630
|
-
let blockNumber: number;
|
|
631
|
-
let uniswapV3: UniswapV3;
|
|
632
|
-
let uniswapV3Mainnet: UniswapV3;
|
|
633
|
-
|
|
634
|
-
const network = Network.ARBITRUM;
|
|
635
|
-
const dexHelper = new DummyDexHelper(network);
|
|
636
|
-
const TokenASymbol = 'USDCe';
|
|
637
|
-
const TokenA = Tokens[network][TokenASymbol];
|
|
638
|
-
|
|
639
|
-
const TokenBSymbol = 'USDT';
|
|
640
|
-
const TokenB = Tokens[network][TokenBSymbol];
|
|
641
|
-
|
|
642
|
-
beforeEach(async () => {
|
|
643
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
644
|
-
uniswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
645
|
-
uniswapV3Mainnet = new UniswapV3(
|
|
646
|
-
Network.ARBITRUM,
|
|
647
|
-
dexKey,
|
|
648
|
-
dexHelper,
|
|
649
|
-
);
|
|
650
|
-
});
|
|
651
|
-
|
|
652
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
653
|
-
|
|
654
|
-
const amounts = [0n, BI_POWS[6], 2000000n];
|
|
655
|
-
|
|
656
|
-
const pools = await uniswapV3.getPoolIdentifiers(
|
|
657
|
-
TokenA,
|
|
658
|
-
TokenB,
|
|
659
|
-
SwapSide.SELL,
|
|
660
|
-
blockNumber,
|
|
661
|
-
);
|
|
662
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
|
|
663
|
-
|
|
664
|
-
expect(pools.length).toBeGreaterThan(0);
|
|
665
|
-
|
|
666
|
-
const poolPrices = await uniswapV3.getPricesVolume(
|
|
667
|
-
TokenA,
|
|
668
|
-
TokenB,
|
|
669
|
-
amounts,
|
|
670
|
-
SwapSide.SELL,
|
|
671
|
-
blockNumber,
|
|
672
|
-
pools,
|
|
673
|
-
);
|
|
674
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
|
|
675
|
-
|
|
676
|
-
expect(poolPrices).not.toBeNull();
|
|
677
|
-
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
678
|
-
|
|
679
|
-
let falseChecksCounter = 0;
|
|
680
|
-
await Promise.all(
|
|
681
|
-
poolPrices!.map(async price => {
|
|
682
|
-
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
683
|
-
const res = await checkOnChainPricing(
|
|
684
|
-
dexHelper,
|
|
685
|
-
uniswapV3,
|
|
686
|
-
'quoteExactInputSingle',
|
|
687
|
-
blockNumber,
|
|
688
|
-
'0x6E7f0Ca45171a4440c0CDdF3A46A8dC5D4c2d4A0',
|
|
689
|
-
price.prices,
|
|
690
|
-
TokenA.address,
|
|
691
|
-
TokenB.address,
|
|
692
|
-
fee,
|
|
693
|
-
amounts,
|
|
694
|
-
);
|
|
695
|
-
if (res === false) falseChecksCounter++;
|
|
696
|
-
}),
|
|
697
|
-
);
|
|
698
|
-
|
|
699
|
-
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
it('getPoolIdentifiers and getPricesVolume BUY', async function () {
|
|
703
|
-
|
|
704
|
-
const amounts = [0n, BI_POWS[6], 2000000n];
|
|
705
|
-
|
|
706
|
-
const pools = await uniswapV3.getPoolIdentifiers(
|
|
707
|
-
TokenA,
|
|
708
|
-
TokenB,
|
|
709
|
-
SwapSide.BUY,
|
|
710
|
-
blockNumber,
|
|
711
|
-
);
|
|
712
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
|
|
713
|
-
|
|
714
|
-
expect(pools.length).toBeGreaterThan(0);
|
|
715
|
-
|
|
716
|
-
const poolPrices = await uniswapV3.getPricesVolume(
|
|
717
|
-
TokenA,
|
|
718
|
-
TokenB,
|
|
719
|
-
amounts,
|
|
720
|
-
SwapSide.BUY,
|
|
721
|
-
blockNumber,
|
|
722
|
-
pools,
|
|
723
|
-
);
|
|
724
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
|
|
725
|
-
|
|
726
|
-
expect(poolPrices).not.toBeNull();
|
|
727
|
-
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
728
|
-
|
|
729
|
-
let falseChecksCounter = 0;
|
|
730
|
-
await Promise.all(
|
|
731
|
-
poolPrices!.map(async price => {
|
|
732
|
-
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
733
|
-
const res = await checkOnChainPricing(
|
|
734
|
-
dexHelper,
|
|
735
|
-
uniswapV3,
|
|
736
|
-
'quoteExactOutputSingle',
|
|
737
|
-
blockNumber,
|
|
738
|
-
'0x6E7f0Ca45171a4440c0CDdF3A46A8dC5D4c2d4A0',
|
|
739
|
-
price.prices,
|
|
740
|
-
TokenA.address,
|
|
741
|
-
TokenB.address,
|
|
742
|
-
fee,
|
|
743
|
-
amounts,
|
|
744
|
-
);
|
|
745
|
-
if (res === false) falseChecksCounter++;
|
|
746
|
-
}),
|
|
747
|
-
);
|
|
748
|
-
|
|
749
|
-
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
750
|
-
});
|
|
751
|
-
|
|
752
|
-
it.skip('getTopPoolsForToken', async function () {
|
|
753
|
-
const poolLiquidity = await uniswapV3.getTopPoolsForToken(
|
|
754
|
-
TokenB.address,
|
|
755
|
-
10,
|
|
756
|
-
);
|
|
757
|
-
console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
|
|
758
|
-
|
|
759
|
-
checkPoolsLiquidity(poolLiquidity, TokenB.address, dexKey);
|
|
760
|
-
});
|
|
761
|
-
});
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
12
12
|
import {
|
|
13
13
|
PoolState,
|
|
14
|
-
DecodedStateMultiCallResultWithRelativeBitmaps,
|
|
14
|
+
DecodedStateMultiCallResultWithRelativeBitmaps,
|
|
15
|
+
DecodeStateMultiCallFunc,
|
|
15
16
|
} from './types';
|
|
16
17
|
import UniswapV3PoolABI from '../../abi/uniswap-v3/UniswapV3Pool.abi.json';
|
|
17
18
|
import { bigIntify, catchParseLogError, isSampled } from '../../utils';
|
|
@@ -60,7 +61,9 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
60
61
|
readonly dexHelper: IDexHelper,
|
|
61
62
|
parentName: string,
|
|
62
63
|
readonly stateMultiContract: Contract,
|
|
63
|
-
readonly decodeStateMultiCallResultWithRelativeBitmaps:
|
|
64
|
+
readonly decodeStateMultiCallResultWithRelativeBitmaps:
|
|
65
|
+
| DecodeStateMultiCallFunc
|
|
66
|
+
| undefined,
|
|
64
67
|
readonly erc20Interface: Interface,
|
|
65
68
|
protected readonly factoryAddress: Address,
|
|
66
69
|
public readonly feeCode: bigint,
|
|
@@ -91,7 +91,7 @@ export class UniswapV3
|
|
|
91
91
|
|
|
92
92
|
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
93
93
|
getDexKeysWithNetwork(
|
|
94
|
-
_.pick(UniswapV3Config, ['UniswapV3', 'QuickSwapV3.1', 'RamsesV2'
|
|
94
|
+
_.pick(UniswapV3Config, ['UniswapV3', 'QuickSwapV3.1', 'RamsesV2']),
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
logger: Logger;
|
|
@@ -120,7 +120,7 @@ export class UniswapV3
|
|
|
120
120
|
this.stateMultiContract = new this.dexHelper.web3Provider.eth.Contract(
|
|
121
121
|
this.config.stateMultiCallAbi !== undefined
|
|
122
122
|
? this.config.stateMultiCallAbi
|
|
123
|
-
: UniswapV3StateMulticallABI as AbiItem[],
|
|
123
|
+
: (UniswapV3StateMulticallABI as AbiItem[]),
|
|
124
124
|
this.config.stateMulticall,
|
|
125
125
|
);
|
|
126
126
|
|
|
@@ -1059,7 +1059,8 @@ export class UniswapV3
|
|
|
1059
1059
|
initHash: this.config.initHash,
|
|
1060
1060
|
subgraphURL: this.config.subgraphURL,
|
|
1061
1061
|
stateMultiCallAbi: this.config.stateMultiCallAbi,
|
|
1062
|
-
decodeStateMultiCallResultWithRelativeBitmaps:
|
|
1062
|
+
decodeStateMultiCallResultWithRelativeBitmaps:
|
|
1063
|
+
this.config.decodeStateMultiCallResultWithRelativeBitmaps,
|
|
1063
1064
|
};
|
|
1064
1065
|
return newConfig;
|
|
1065
1066
|
}
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -299,6 +299,14 @@ export const Tokens: {
|
|
|
299
299
|
address: '0xc411db5f5eb3f7d552f9b8454b2d74097ccde6e3',
|
|
300
300
|
decimals: 6,
|
|
301
301
|
},
|
|
302
|
+
GHO: {
|
|
303
|
+
address: '0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f',
|
|
304
|
+
decimals: 18,
|
|
305
|
+
},
|
|
306
|
+
crvUSD: {
|
|
307
|
+
address: '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
|
|
308
|
+
decimals: 18,
|
|
309
|
+
},
|
|
302
310
|
},
|
|
303
311
|
[Network.ROPSTEN]: {
|
|
304
312
|
DAI: {
|
|
@@ -908,6 +916,8 @@ export const Holders: {
|
|
|
908
916
|
aEthWETH: '0x645C4c0c95C1Aa6EF25d12f4a25038cA9b0C6Cc7',
|
|
909
917
|
dUSDC: '0x2FC2F705110A7F46Ce85F701d7217EF1018f01A3',
|
|
910
918
|
PSP: '0xE5E5440a1CE69C5cf67BFFA74d185e57c31b43E5',
|
|
919
|
+
crvUSD: '0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635',
|
|
920
|
+
GHO: '0x844Dc85EdD8492A56228D293cfEbb823EF3E10EC',
|
|
911
921
|
},
|
|
912
922
|
[Network.ROPSTEN]: {
|
|
913
923
|
ETH: '0x43262A12d8610AA70C15DbaeAC321d51613c9071',
|
package/.idea/aws.xml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="accountSettings">
|
|
4
|
-
<option name="activeProfile" value="profile:default" />
|
|
5
|
-
<option name="activeRegion" value="us-east-1" />
|
|
6
|
-
<option name="recentlyUsedProfiles">
|
|
7
|
-
<list>
|
|
8
|
-
<option value="profile:default" />
|
|
9
|
-
</list>
|
|
10
|
-
</option>
|
|
11
|
-
<option name="recentlyUsedRegions">
|
|
12
|
-
<list>
|
|
13
|
-
<option value="us-east-1" />
|
|
14
|
-
</list>
|
|
15
|
-
</option>
|
|
16
|
-
</component>
|
|
17
|
-
</project>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<ScalaCodeStyleSettings>
|
|
4
|
-
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
|
5
|
-
</ScalaCodeStyleSettings>
|
|
6
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
7
|
-
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
|
|
8
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
9
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
10
|
-
</TypeScriptCodeStyleSettings>
|
|
11
|
-
<codeStyleSettings language="TypeScript">
|
|
12
|
-
<indentOptions>
|
|
13
|
-
<option name="INDENT_SIZE" value="2" />
|
|
14
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
15
|
-
<option name="TAB_SIZE" value="2" />
|
|
16
|
-
</indentOptions>
|
|
17
|
-
</codeStyleSettings>
|
|
18
|
-
</code_scheme>
|
|
19
|
-
</component>
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|