@paraswap/dex-lib 2.41.2 → 2.41.3
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/index.js +2 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/lighter-v1/abi/erc20.json +222 -0
- package/build/dex/lighter-v1/abi/factory.json +291 -0
- package/build/dex/lighter-v1/abi/order_book.json +594 -0
- package/build/dex/lighter-v1/abi/order_book_helper.json +176 -0
- package/build/dex/lighter-v1/abi/router.json +488 -0
- package/build/dex/lighter-v1/config.d.ts +4 -0
- package/build/dex/lighter-v1/config.js +17 -0
- package/build/dex/lighter-v1/config.js.map +1 -0
- package/build/dex/lighter-v1/constants.d.ts +2 -0
- package/build/dex/lighter-v1/constants.js +13 -0
- package/build/dex/lighter-v1/constants.js.map +1 -0
- package/build/dex/lighter-v1/lighter-v1-pool.d.ts +57 -0
- package/build/dex/lighter-v1/lighter-v1-pool.js +310 -0
- package/build/dex/lighter-v1/lighter-v1-pool.js.map +1 -0
- package/build/dex/lighter-v1/lighter-v1.d.ts +45 -0
- package/build/dex/lighter-v1/lighter-v1.js +331 -0
- package/build/dex/lighter-v1/lighter-v1.js.map +1 -0
- package/build/dex/lighter-v1/types.d.ts +40 -0
- package/build/dex/lighter-v1/types.js +3 -0
- package/build/dex/lighter-v1/types.js.map +1 -0
- package/build/dex/solidly/config.js +3 -3
- package/build/dex/solidly/config.js.map +1 -1
- package/build/dex/solidly/forks-override/velocimeter.d.ts +20 -0
- package/build/dex/solidly/forks-override/velocimeter.js +42 -0
- package/build/dex/solidly/forks-override/velocimeter.js.map +1 -0
- package/build/dex/solidly/solidly.js +1 -1
- package/build/dex/solidly/solidly.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/index.ts +2 -2
- package/src/dex/solidly/config.ts +3 -3
- package/src/dex/solidly/forks-override/{fvm.ts → velocimeter.ts} +6 -6
- package/src/dex/solidly/solidly-e2e.test.ts +4 -4
- package/src/dex/solidly/solidly-integration.test.ts +22 -22
- package/src/dex/solidly/solidly.ts +1 -1
|
@@ -178,7 +178,7 @@ export const SolidlyConfig: DexConfigMap<DexParams> = {
|
|
|
178
178
|
poolGasCost: 180 * 1000,
|
|
179
179
|
},
|
|
180
180
|
},
|
|
181
|
-
|
|
181
|
+
Velocimeter: {
|
|
182
182
|
[Network.FANTOM]: {
|
|
183
183
|
factoryAddress: '0x472f3C3c9608fe0aE8d702f3f8A2d12c410C881A',
|
|
184
184
|
router: '0x93d2611EB8b85bE4FDEa9D94Ce9913D90072eC0f',
|
|
@@ -205,7 +205,7 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
205
205
|
[SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 3 }], // dystopia
|
|
206
206
|
},
|
|
207
207
|
[Network.FANTOM]: {
|
|
208
|
-
[SwapSide.SELL]: [{ name: 'FantomAdapter01', index: 10 }], // solidly, spiritSwapV2, equalizer,
|
|
208
|
+
[SwapSide.SELL]: [{ name: 'FantomAdapter01', index: 10 }], // solidly, spiritSwapV2, equalizer, velocimeter
|
|
209
209
|
},
|
|
210
210
|
[Network.OPTIMISM]: {
|
|
211
211
|
[SwapSide.SELL]: [{ name: 'OptimismAdapter01', index: 8 }], // velodrome
|
|
@@ -223,6 +223,6 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
223
223
|
[SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 1 }], // chronos, ramses
|
|
224
224
|
},
|
|
225
225
|
[Network.BASE]: {
|
|
226
|
-
[SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 3 }], // aerodrome, equalizer
|
|
226
|
+
[SwapSide.SELL]: [{ name: 'BaseAdapter01', index: 3 }], // aerodrome, equalizer, velocimeter
|
|
227
227
|
},
|
|
228
228
|
};
|
|
@@ -7,7 +7,7 @@ import { getDexKeysWithNetwork } from '../../../utils';
|
|
|
7
7
|
import { SolidlyConfig } from '../config';
|
|
8
8
|
import _ from 'lodash';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const velocimeterFactoryABI = [
|
|
11
11
|
{
|
|
12
12
|
inputs: [{ internalType: '_pair', name: '_stable', type: 'address' }],
|
|
13
13
|
name: 'getFee',
|
|
@@ -17,11 +17,11 @@ const FvmFactoryABI = [
|
|
|
17
17
|
},
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const velocimeterFactoryIface = new Interface(velocimeterFactoryABI);
|
|
21
21
|
|
|
22
|
-
export class
|
|
22
|
+
export class Velocimeter extends Solidly {
|
|
23
23
|
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
24
|
-
getDexKeysWithNetwork(_.pick(SolidlyConfig, ['
|
|
24
|
+
getDexKeysWithNetwork(_.pick(SolidlyConfig, ['Velocimeter']));
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
protected network: Network,
|
|
@@ -39,11 +39,11 @@ export class Fvm extends Solidly {
|
|
|
39
39
|
protected getFeesMultiCallData(pair: SolidlyPair) {
|
|
40
40
|
const callEntry = {
|
|
41
41
|
target: this.factoryAddress,
|
|
42
|
-
callData:
|
|
42
|
+
callData: velocimeterFactoryIface.encodeFunctionData('getFee', [pair.exchange]),
|
|
43
43
|
};
|
|
44
44
|
const callDecoder = (values: any[]) =>
|
|
45
45
|
parseInt(
|
|
46
|
-
|
|
46
|
+
velocimeterFactoryIface.decodeFunctionResult('getFee', values)[0].toString(),
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
return {
|
|
@@ -416,8 +416,8 @@ describe('Solidly E2E', () => {
|
|
|
416
416
|
);
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
-
describe('
|
|
420
|
-
const dexKey = '
|
|
419
|
+
describe('Velocimeter', () => {
|
|
420
|
+
const dexKey = 'Velocimeter';
|
|
421
421
|
const network = Network.FANTOM;
|
|
422
422
|
|
|
423
423
|
const tokenASymbol: string = 'lzUSDC';
|
|
@@ -1514,8 +1514,8 @@ describe('Solidly E2E', () => {
|
|
|
1514
1514
|
);
|
|
1515
1515
|
});
|
|
1516
1516
|
|
|
1517
|
-
describe('
|
|
1518
|
-
const dexKey = '
|
|
1517
|
+
describe('Velocimeter', () => {
|
|
1518
|
+
const dexKey = 'Velocimeter';
|
|
1519
1519
|
|
|
1520
1520
|
const tokenASymbol: string = 'USDbC';
|
|
1521
1521
|
const tokenBSymbol: string = 'DAI';
|
|
@@ -17,7 +17,7 @@ import { Ramses } from './forks-override/ramses';
|
|
|
17
17
|
import * as util from 'util';
|
|
18
18
|
import { VelodromeV2 } from './forks-override/velodromeV2';
|
|
19
19
|
import { Equalizer } from './forks-override/equalizer';
|
|
20
|
-
import {
|
|
20
|
+
import { Velocimeter } from './forks-override/velocimeter';
|
|
21
21
|
|
|
22
22
|
const amounts18 = [0n, BI_POWS[18], 2000000000000000000n];
|
|
23
23
|
const amounts6 = [0n, BI_POWS[6], 2000000n];
|
|
@@ -527,9 +527,9 @@ describe('Solidly integration tests', () => {
|
|
|
527
527
|
});
|
|
528
528
|
});
|
|
529
529
|
|
|
530
|
-
describe('
|
|
531
|
-
const dexKey = '
|
|
532
|
-
const
|
|
530
|
+
describe('Velocimeter', () => {
|
|
531
|
+
const dexKey = 'Velocimeter';
|
|
532
|
+
const velocimeter = new Velocimeter(network, dexKey, dexHelper);
|
|
533
533
|
|
|
534
534
|
describe('UniswapV2 like pool', function () {
|
|
535
535
|
const TokenASymbol = 'WFTM';
|
|
@@ -541,7 +541,7 @@ describe('Solidly integration tests', () => {
|
|
|
541
541
|
|
|
542
542
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
543
543
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
544
|
-
const pools = await
|
|
544
|
+
const pools = await velocimeter.getPoolIdentifiers(
|
|
545
545
|
tokenA,
|
|
546
546
|
tokenB,
|
|
547
547
|
SwapSide.SELL,
|
|
@@ -554,7 +554,7 @@ describe('Solidly integration tests', () => {
|
|
|
554
554
|
|
|
555
555
|
expect(pools.length).toBeGreaterThan(0);
|
|
556
556
|
|
|
557
|
-
const poolPrices = await
|
|
557
|
+
const poolPrices = await velocimeter.getPricesVolume(
|
|
558
558
|
tokenA,
|
|
559
559
|
tokenB,
|
|
560
560
|
amounts,
|
|
@@ -574,7 +574,7 @@ describe('Solidly integration tests', () => {
|
|
|
574
574
|
|
|
575
575
|
for (const poolPrice of poolPrices || []) {
|
|
576
576
|
await checkOnChainPricing(
|
|
577
|
-
|
|
577
|
+
velocimeter,
|
|
578
578
|
'getAmountOut',
|
|
579
579
|
blocknumber,
|
|
580
580
|
poolPrice.prices,
|
|
@@ -596,7 +596,7 @@ describe('Solidly integration tests', () => {
|
|
|
596
596
|
|
|
597
597
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
598
598
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
599
|
-
const pools = await
|
|
599
|
+
const pools = await velocimeter.getPoolIdentifiers(
|
|
600
600
|
tokenA,
|
|
601
601
|
tokenB,
|
|
602
602
|
SwapSide.SELL,
|
|
@@ -609,7 +609,7 @@ describe('Solidly integration tests', () => {
|
|
|
609
609
|
|
|
610
610
|
expect(pools.length).toBeGreaterThan(0);
|
|
611
611
|
|
|
612
|
-
const poolPrices = await
|
|
612
|
+
const poolPrices = await velocimeter.getPricesVolume(
|
|
613
613
|
tokenA,
|
|
614
614
|
tokenB,
|
|
615
615
|
amounts,
|
|
@@ -628,7 +628,7 @@ describe('Solidly integration tests', () => {
|
|
|
628
628
|
// Check if onchain pricing equals to calculated ones
|
|
629
629
|
for (const poolPrice of poolPrices || []) {
|
|
630
630
|
await checkOnChainPricing(
|
|
631
|
-
|
|
631
|
+
velocimeter,
|
|
632
632
|
'getAmountOut',
|
|
633
633
|
blocknumber,
|
|
634
634
|
poolPrice.prices,
|
|
@@ -652,7 +652,7 @@ describe('Solidly integration tests', () => {
|
|
|
652
652
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
653
653
|
// const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
654
654
|
const blocknumber = 67666611;
|
|
655
|
-
const pools = await
|
|
655
|
+
const pools = await velocimeter.getPoolIdentifiers(
|
|
656
656
|
tokenA,
|
|
657
657
|
tokenB,
|
|
658
658
|
SwapSide.SELL,
|
|
@@ -665,7 +665,7 @@ describe('Solidly integration tests', () => {
|
|
|
665
665
|
|
|
666
666
|
expect(pools.length).toBeGreaterThan(0);
|
|
667
667
|
|
|
668
|
-
const poolPrices = await
|
|
668
|
+
const poolPrices = await velocimeter.getPricesVolume(
|
|
669
669
|
tokenA,
|
|
670
670
|
tokenB,
|
|
671
671
|
amounts,
|
|
@@ -684,7 +684,7 @@ describe('Solidly integration tests', () => {
|
|
|
684
684
|
// Check if onchain pricing equals to calculated ones
|
|
685
685
|
for (const poolPrice of poolPrices || []) {
|
|
686
686
|
await checkOnChainPricing(
|
|
687
|
-
|
|
687
|
+
velocimeter,
|
|
688
688
|
'getAmountOut',
|
|
689
689
|
blocknumber,
|
|
690
690
|
poolPrice.prices,
|
|
@@ -1439,9 +1439,9 @@ describe('Solidly integration tests', () => {
|
|
|
1439
1439
|
});
|
|
1440
1440
|
});
|
|
1441
1441
|
|
|
1442
|
-
describe('
|
|
1443
|
-
const dexKey = '
|
|
1444
|
-
const
|
|
1442
|
+
describe('Velocimeter', () => {
|
|
1443
|
+
const dexKey = 'Velocimeter';
|
|
1444
|
+
const velocimeter = new Velocimeter(network, dexKey, dexHelper);
|
|
1445
1445
|
|
|
1446
1446
|
describe('UniswapV2 like pool', function () {
|
|
1447
1447
|
const TokenASymbol = 'WETH';
|
|
@@ -1453,7 +1453,7 @@ describe('Solidly integration tests', () => {
|
|
|
1453
1453
|
|
|
1454
1454
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
1455
1455
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1456
|
-
const pools = await
|
|
1456
|
+
const pools = await velocimeter.getPoolIdentifiers(
|
|
1457
1457
|
tokenA,
|
|
1458
1458
|
tokenB,
|
|
1459
1459
|
SwapSide.SELL,
|
|
@@ -1466,7 +1466,7 @@ describe('Solidly integration tests', () => {
|
|
|
1466
1466
|
|
|
1467
1467
|
expect(pools.length).toBeGreaterThan(0);
|
|
1468
1468
|
|
|
1469
|
-
const poolPrices = await
|
|
1469
|
+
const poolPrices = await velocimeter.getPricesVolume(
|
|
1470
1470
|
tokenA,
|
|
1471
1471
|
tokenB,
|
|
1472
1472
|
amounts,
|
|
@@ -1486,7 +1486,7 @@ describe('Solidly integration tests', () => {
|
|
|
1486
1486
|
|
|
1487
1487
|
for (const poolPrice of poolPrices || []) {
|
|
1488
1488
|
await checkOnChainPricing(
|
|
1489
|
-
|
|
1489
|
+
velocimeter,
|
|
1490
1490
|
'getAmountOut',
|
|
1491
1491
|
blocknumber,
|
|
1492
1492
|
poolPrice.prices,
|
|
@@ -1508,7 +1508,7 @@ describe('Solidly integration tests', () => {
|
|
|
1508
1508
|
|
|
1509
1509
|
it('getPoolIdentifiers and getPricesVolume', async function () {
|
|
1510
1510
|
const blocknumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
1511
|
-
const pools = await
|
|
1511
|
+
const pools = await velocimeter.getPoolIdentifiers(
|
|
1512
1512
|
tokenA,
|
|
1513
1513
|
tokenB,
|
|
1514
1514
|
SwapSide.SELL,
|
|
@@ -1521,7 +1521,7 @@ describe('Solidly integration tests', () => {
|
|
|
1521
1521
|
|
|
1522
1522
|
expect(pools.length).toBeGreaterThan(0);
|
|
1523
1523
|
|
|
1524
|
-
const poolPrices = await
|
|
1524
|
+
const poolPrices = await velocimeter.getPricesVolume(
|
|
1525
1525
|
tokenA,
|
|
1526
1526
|
tokenB,
|
|
1527
1527
|
amounts,
|
|
@@ -1540,7 +1540,7 @@ describe('Solidly integration tests', () => {
|
|
|
1540
1540
|
// Check if onchain pricing equals to calculated ones
|
|
1541
1541
|
for (const poolPrice of poolPrices || []) {
|
|
1542
1542
|
await checkOnChainPricing(
|
|
1543
|
-
|
|
1543
|
+
velocimeter,
|
|
1544
1544
|
'getAmountOut',
|
|
1545
1545
|
blocknumber,
|
|
1546
1546
|
poolPrice.prices,
|