@paraswap/dex-lib 2.28.11-ramses-v2 → 2.28.11
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/config.d.ts +0 -1
- package/build/config.js +9 -1
- package/build/config.js.map +1 -1
- package/build/dex/algebra/algebra.d.ts +1 -1
- package/build/dex/algebra/algebra.js +2 -0
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +0 -1
- package/build/dex/algebra/config.js.map +1 -1
- package/build/dex/algebra/lib/TickTable.js +51 -40
- package/build/dex/algebra/lib/TickTable.js.map +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 -22
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/types.d.ts +1 -6
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +2 -3
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +2 -5
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +3 -7
- 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/build/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/config.ts +11 -1
- package/src/dex/algebra/algebra-integration.test.ts +194 -16
- package/src/dex/algebra/algebra.ts +5 -1
- package/src/dex/algebra/config.ts +0 -1
- package/src/dex/algebra/lib/TickTable.ts +75 -74
- package/src/dex/uniswap-v3/config.ts +0 -22
- package/src/dex/uniswap-v3/types.ts +1 -7
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +354 -445
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +13 -171
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +4 -9
- package/src/dex/uniswap-v3/uniswap-v3.ts +2 -7
- package/src/types.ts +1 -0
- package/tests/constants-e2e.ts +5 -1
- 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/RamsesV2StateMulticall.abi.json +0 -891
- 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/solidly/forks-override/ramses.d.ts +0 -8
- package/build/dex/solidly/forks-override/ramses.js +0 -15
- package/build/dex/solidly/forks-override/ramses.js.map +0 -1
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.d.ts +0 -4
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.js +0 -63
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.js.map +0 -1
- package/src/abi/RamsesV2Pool.abi.json +0 -1554
- package/src/abi/RamsesV2Quoter.abi.json +0 -274
- package/src/abi/RamsesV2StateMulticall.abi.json +0 -891
- package/src/dex/uniswap-v3/forks/ramses-v2/utils.ts +0 -72
- /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
|
@@ -3,13 +3,13 @@ import dotenv from 'dotenv';
|
|
|
3
3
|
dotenv.config();
|
|
4
4
|
|
|
5
5
|
import { Interface, Result } from '@ethersproject/abi';
|
|
6
|
-
import { DummyDexHelper
|
|
6
|
+
import { DummyDexHelper } from '../../dex-helper/index';
|
|
7
7
|
import { Network, SwapSide } from '../../constants';
|
|
8
8
|
import { BI_POWS } from '../../bigint-constants';
|
|
9
9
|
import { UniswapV3 } from './uniswap-v3';
|
|
10
10
|
import { checkPoolPrices, checkPoolsLiquidity } from '../../../tests/utils';
|
|
11
11
|
import { Tokens } from '../../../tests/constants-e2e';
|
|
12
|
-
import
|
|
12
|
+
import UniswapV3QuoterABI from '../../abi/uniswap-v3/UniswapV3Quoter.abi.json';
|
|
13
13
|
import { Address } from '@paraswap/core';
|
|
14
14
|
|
|
15
15
|
const network = Network.POLYGON;
|
|
@@ -28,8 +28,10 @@ const amounts = [
|
|
|
28
28
|
|
|
29
29
|
const amountsBuy = [0n, 1n * BI_POWS[18], 2n * BI_POWS[18], 3n * BI_POWS[18]];
|
|
30
30
|
|
|
31
|
+
const dexHelper = new DummyDexHelper(network);
|
|
32
|
+
const dexKey = 'UniswapV3';
|
|
31
33
|
|
|
32
|
-
const quoterIface = new Interface(
|
|
34
|
+
const quoterIface = new Interface(UniswapV3QuoterABI);
|
|
33
35
|
|
|
34
36
|
function getReaderCalldata(
|
|
35
37
|
exchangeAddress: string,
|
|
@@ -43,13 +45,11 @@ function getReaderCalldata(
|
|
|
43
45
|
return amounts.map(amount => ({
|
|
44
46
|
target: exchangeAddress,
|
|
45
47
|
callData: readerIface.encodeFunctionData(funcName, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
0,
|
|
52
|
-
]
|
|
48
|
+
tokenIn,
|
|
49
|
+
tokenOut,
|
|
50
|
+
fee,
|
|
51
|
+
amount,
|
|
52
|
+
0n,
|
|
53
53
|
]),
|
|
54
54
|
}));
|
|
55
55
|
}
|
|
@@ -66,11 +66,9 @@ function decodeReaderResult(
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async function checkOnChainPricing(
|
|
69
|
-
dexHelper: IDexHelper,
|
|
70
69
|
uniswapV3: UniswapV3,
|
|
71
70
|
funcName: string,
|
|
72
71
|
blockNumber: number,
|
|
73
|
-
exchangeAddress: string,
|
|
74
72
|
prices: bigint[],
|
|
75
73
|
tokenIn: Address,
|
|
76
74
|
tokenOut: Address,
|
|
@@ -78,7 +76,7 @@ async function checkOnChainPricing(
|
|
|
78
76
|
_amounts: bigint[],
|
|
79
77
|
) {
|
|
80
78
|
// Quoter address
|
|
81
|
-
|
|
79
|
+
const exchangeAddress = '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6';
|
|
82
80
|
const readerIface = quoterIface;
|
|
83
81
|
|
|
84
82
|
const sum = prices.reduce((acc, curr) => (acc += curr), 0n);
|
|
@@ -119,8 +117,6 @@ async function checkOnChainPricing(
|
|
|
119
117
|
decodeReaderResult(readerResult, readerIface, funcName),
|
|
120
118
|
);
|
|
121
119
|
|
|
122
|
-
console.log('EXPECTED PRICES: ', expectedPrices);
|
|
123
|
-
|
|
124
120
|
let firstZeroIndex = prices.slice(1).indexOf(0n);
|
|
125
121
|
|
|
126
122
|
// we skipped first, so add +1 on result
|
|
@@ -134,9 +130,6 @@ async function checkOnChainPricing(
|
|
|
134
130
|
}
|
|
135
131
|
|
|
136
132
|
describe('UniswapV3', function () {
|
|
137
|
-
const dexHelper = new DummyDexHelper(network);
|
|
138
|
-
const dexKey = 'UniswapV3';
|
|
139
|
-
|
|
140
133
|
let blockNumber: number;
|
|
141
134
|
let uniswapV3: UniswapV3;
|
|
142
135
|
let uniswapV3Mainnet: UniswapV3;
|
|
@@ -145,9 +138,9 @@ describe('UniswapV3', function () {
|
|
|
145
138
|
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
146
139
|
uniswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
147
140
|
uniswapV3Mainnet = new UniswapV3(
|
|
148
|
-
Network.
|
|
141
|
+
Network.MAINNET,
|
|
149
142
|
dexKey,
|
|
150
|
-
new DummyDexHelper(Network.
|
|
143
|
+
new DummyDexHelper(Network.MAINNET),
|
|
151
144
|
);
|
|
152
145
|
});
|
|
153
146
|
|
|
@@ -180,11 +173,9 @@ describe('UniswapV3', function () {
|
|
|
180
173
|
poolPrices!.map(async price => {
|
|
181
174
|
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
182
175
|
const res = await checkOnChainPricing(
|
|
183
|
-
dexHelper,
|
|
184
176
|
uniswapV3,
|
|
185
177
|
'quoteExactInputSingle',
|
|
186
178
|
blockNumber,
|
|
187
|
-
'0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
188
179
|
price.prices,
|
|
189
180
|
TokenA.address,
|
|
190
181
|
TokenB.address,
|
|
@@ -228,11 +219,9 @@ describe('UniswapV3', function () {
|
|
|
228
219
|
poolPrices!.map(async price => {
|
|
229
220
|
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
230
221
|
const res = await checkOnChainPricing(
|
|
231
|
-
dexHelper,
|
|
232
222
|
uniswapV3,
|
|
233
223
|
'quoteExactOutputSingle',
|
|
234
224
|
blockNumber,
|
|
235
|
-
'0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
236
225
|
price.prices,
|
|
237
226
|
TokenA.address,
|
|
238
227
|
TokenB.address,
|
|
@@ -340,11 +329,9 @@ describe('UniswapV3', function () {
|
|
|
340
329
|
poolPrices!.map(async price => {
|
|
341
330
|
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
342
331
|
const res = await checkOnChainPricing(
|
|
343
|
-
dexHelper,
|
|
344
332
|
uniswapV3,
|
|
345
333
|
'quoteExactInputSingle',
|
|
346
334
|
blockNumber,
|
|
347
|
-
'0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
348
335
|
price.prices,
|
|
349
336
|
TokenA.address,
|
|
350
337
|
TokenB.address,
|
|
@@ -452,11 +439,9 @@ describe('UniswapV3', function () {
|
|
|
452
439
|
poolPrices!.map(async price => {
|
|
453
440
|
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
454
441
|
const res = await checkOnChainPricing(
|
|
455
|
-
dexHelper,
|
|
456
442
|
uniswapV3,
|
|
457
443
|
'quoteExactOutputSingle',
|
|
458
444
|
blockNumber,
|
|
459
|
-
'0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
460
445
|
price.prices,
|
|
461
446
|
TokenA.address,
|
|
462
447
|
TokenB.address,
|
|
@@ -481,146 +466,3 @@ describe('UniswapV3', function () {
|
|
|
481
466
|
}
|
|
482
467
|
});
|
|
483
468
|
});
|
|
484
|
-
|
|
485
|
-
describe('RamsesV2', () => {
|
|
486
|
-
const dexKey = 'RamsesV2';
|
|
487
|
-
let blockNumber: number;
|
|
488
|
-
let uniswapV3: UniswapV3;
|
|
489
|
-
let uniswapV3Mainnet: UniswapV3;
|
|
490
|
-
|
|
491
|
-
const network = Network.ARBITRUM;
|
|
492
|
-
const dexHelper = new DummyDexHelper(network);
|
|
493
|
-
const TokenASymbol = 'USDCe';
|
|
494
|
-
const TokenA = Tokens[network][TokenASymbol];
|
|
495
|
-
|
|
496
|
-
const TokenBSymbol = 'USDC';
|
|
497
|
-
const TokenB = Tokens[network][TokenBSymbol];
|
|
498
|
-
|
|
499
|
-
beforeEach(async () => {
|
|
500
|
-
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
501
|
-
uniswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
502
|
-
uniswapV3Mainnet = new UniswapV3(
|
|
503
|
-
Network.ARBITRUM,
|
|
504
|
-
dexKey,
|
|
505
|
-
dexHelper,
|
|
506
|
-
);
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
510
|
-
|
|
511
|
-
const amounts = [
|
|
512
|
-
0n,
|
|
513
|
-
6000000n,
|
|
514
|
-
12000000n,
|
|
515
|
-
18000000n,
|
|
516
|
-
24000000n,
|
|
517
|
-
30000000n,
|
|
518
|
-
36000000n,
|
|
519
|
-
42000000n,
|
|
520
|
-
];
|
|
521
|
-
|
|
522
|
-
const pools = await uniswapV3.getPoolIdentifiers(
|
|
523
|
-
TokenA,
|
|
524
|
-
TokenB,
|
|
525
|
-
SwapSide.SELL,
|
|
526
|
-
blockNumber,
|
|
527
|
-
);
|
|
528
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
|
|
529
|
-
|
|
530
|
-
expect(pools.length).toBeGreaterThan(0);
|
|
531
|
-
|
|
532
|
-
const poolPrices = await uniswapV3.getPricesVolume(
|
|
533
|
-
TokenA,
|
|
534
|
-
TokenB,
|
|
535
|
-
amounts,
|
|
536
|
-
SwapSide.SELL,
|
|
537
|
-
blockNumber,
|
|
538
|
-
pools,
|
|
539
|
-
);
|
|
540
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
|
|
541
|
-
|
|
542
|
-
expect(poolPrices).not.toBeNull();
|
|
543
|
-
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
544
|
-
|
|
545
|
-
let falseChecksCounter = 0;
|
|
546
|
-
await Promise.all(
|
|
547
|
-
poolPrices!.map(async price => {
|
|
548
|
-
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
549
|
-
const res = await checkOnChainPricing(
|
|
550
|
-
dexHelper,
|
|
551
|
-
uniswapV3,
|
|
552
|
-
'quoteExactInputSingle',
|
|
553
|
-
blockNumber,
|
|
554
|
-
'0xAA20EFF7ad2F523590dE6c04918DaAE0904E3b20',
|
|
555
|
-
price.prices,
|
|
556
|
-
TokenA.address,
|
|
557
|
-
TokenB.address,
|
|
558
|
-
fee,
|
|
559
|
-
amounts,
|
|
560
|
-
);
|
|
561
|
-
if (res === false) falseChecksCounter++;
|
|
562
|
-
}),
|
|
563
|
-
);
|
|
564
|
-
|
|
565
|
-
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
it('getPoolIdentifiers and getPricesVolume BUY', async function () {
|
|
569
|
-
|
|
570
|
-
const amounts = [
|
|
571
|
-
0n,
|
|
572
|
-
6000000n,
|
|
573
|
-
12000000n,
|
|
574
|
-
18000000n,
|
|
575
|
-
24000000n,
|
|
576
|
-
30000000n,
|
|
577
|
-
36000000n,
|
|
578
|
-
42000000n,
|
|
579
|
-
];
|
|
580
|
-
|
|
581
|
-
const pools = await uniswapV3.getPoolIdentifiers(
|
|
582
|
-
TokenA,
|
|
583
|
-
TokenB,
|
|
584
|
-
SwapSide.BUY,
|
|
585
|
-
blockNumber,
|
|
586
|
-
);
|
|
587
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
|
|
588
|
-
|
|
589
|
-
expect(pools.length).toBeGreaterThan(0);
|
|
590
|
-
|
|
591
|
-
const poolPrices = await uniswapV3.getPricesVolume(
|
|
592
|
-
TokenA,
|
|
593
|
-
TokenB,
|
|
594
|
-
amounts,
|
|
595
|
-
SwapSide.BUY,
|
|
596
|
-
blockNumber,
|
|
597
|
-
pools,
|
|
598
|
-
);
|
|
599
|
-
console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
|
|
600
|
-
|
|
601
|
-
expect(poolPrices).not.toBeNull();
|
|
602
|
-
checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
|
|
603
|
-
|
|
604
|
-
let falseChecksCounter = 0;
|
|
605
|
-
await Promise.all(
|
|
606
|
-
poolPrices!.map(async price => {
|
|
607
|
-
const fee = uniswapV3.eventPools[price.poolIdentifier!]!.feeCode;
|
|
608
|
-
const res = await checkOnChainPricing(
|
|
609
|
-
dexHelper,
|
|
610
|
-
uniswapV3,
|
|
611
|
-
'quoteExactOutputSingle',
|
|
612
|
-
blockNumber,
|
|
613
|
-
'0xAA20EFF7ad2F523590dE6c04918DaAE0904E3b20',
|
|
614
|
-
price.prices,
|
|
615
|
-
TokenA.address,
|
|
616
|
-
TokenB.address,
|
|
617
|
-
fee,
|
|
618
|
-
amounts,
|
|
619
|
-
);
|
|
620
|
-
if (res === false) falseChecksCounter++;
|
|
621
|
-
}),
|
|
622
|
-
);
|
|
623
|
-
|
|
624
|
-
expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
|
|
625
|
-
});
|
|
626
|
-
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Contract } from 'web3-eth-contract';
|
|
3
3
|
import { Interface } from '@ethersproject/abi';
|
|
4
|
-
import {
|
|
4
|
+
import { ethers } from 'ethers';
|
|
5
5
|
import { assert, DeepReadonly } from 'ts-essentials';
|
|
6
6
|
import { Log, Logger, BlockHeader, Address } from '../../types';
|
|
7
7
|
import {
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
12
12
|
import {
|
|
13
13
|
PoolState,
|
|
14
|
-
DecodedStateMultiCallResultWithRelativeBitmaps,
|
|
14
|
+
DecodedStateMultiCallResultWithRelativeBitmaps,
|
|
15
15
|
} from './types';
|
|
16
16
|
import UniswapV3PoolABI from '../../abi/uniswap-v3/UniswapV3Pool.abi.json';
|
|
17
17
|
import { bigIntify, catchParseLogError, isSampled } from '../../utils';
|
|
18
18
|
import { uniswapV3Math } from './contract-math/uniswap-v3-math';
|
|
19
|
-
import { MultiCallParams
|
|
19
|
+
import { MultiCallParams } from '../../lib/multi-wrapper';
|
|
20
20
|
import {
|
|
21
21
|
OUT_OF_RANGE_ERROR_POSTFIX,
|
|
22
22
|
TICK_BITMAP_BUFFER,
|
|
@@ -60,7 +60,6 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
60
60
|
readonly dexHelper: IDexHelper,
|
|
61
61
|
parentName: string,
|
|
62
62
|
readonly stateMultiContract: Contract,
|
|
63
|
-
readonly decodeStateMultiCallResultWithRelativeBitmaps: DecodeStateMultiCallFunc | undefined,
|
|
64
63
|
readonly erc20Interface: Interface,
|
|
65
64
|
protected readonly factoryAddress: Address,
|
|
66
65
|
public readonly feeCode: bigint,
|
|
@@ -227,13 +226,9 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
227
226
|
this.getBitmapRangeToRequest(),
|
|
228
227
|
)
|
|
229
228
|
.encodeABI(),
|
|
230
|
-
decodeFunction:
|
|
231
|
-
this.decodeStateMultiCallResultWithRelativeBitmaps !== undefined
|
|
232
|
-
? this.decodeStateMultiCallResultWithRelativeBitmaps
|
|
233
|
-
: decodeStateMultiCallResultWithRelativeBitmaps,
|
|
229
|
+
decodeFunction: decodeStateMultiCallResultWithRelativeBitmaps,
|
|
234
230
|
},
|
|
235
231
|
];
|
|
236
|
-
|
|
237
232
|
this._stateRequestCallData = callData;
|
|
238
233
|
}
|
|
239
234
|
return this._stateRequestCallData;
|
|
@@ -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'
|
|
94
|
+
_.pick(UniswapV3Config, ['UniswapV3', 'QuickSwapV3.1']),
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
logger: Logger;
|
|
@@ -118,9 +118,7 @@ export class UniswapV3
|
|
|
118
118
|
this.config.uniswapMulticall,
|
|
119
119
|
);
|
|
120
120
|
this.stateMultiContract = new this.dexHelper.web3Provider.eth.Contract(
|
|
121
|
-
|
|
122
|
-
? this.config.stateMultiCallAbi
|
|
123
|
-
: UniswapV3StateMulticallABI as AbiItem[],
|
|
121
|
+
UniswapV3StateMulticallABI as AbiItem[],
|
|
124
122
|
this.config.stateMulticall,
|
|
125
123
|
);
|
|
126
124
|
|
|
@@ -241,7 +239,6 @@ export class UniswapV3
|
|
|
241
239
|
this.dexHelper,
|
|
242
240
|
this.dexKey,
|
|
243
241
|
this.stateMultiContract,
|
|
244
|
-
this.config.decodeStateMultiCallResultWithRelativeBitmaps,
|
|
245
242
|
this.erc20Interface,
|
|
246
243
|
this.config.factory,
|
|
247
244
|
fee,
|
|
@@ -1058,8 +1055,6 @@ export class UniswapV3
|
|
|
1058
1055
|
deployer: this.config.deployer?.toLowerCase(),
|
|
1059
1056
|
initHash: this.config.initHash,
|
|
1060
1057
|
subgraphURL: this.config.subgraphURL,
|
|
1061
|
-
stateMultiCallAbi: this.config.stateMultiCallAbi,
|
|
1062
|
-
decodeStateMultiCallResultWithRelativeBitmaps: this.config.decodeStateMultiCallResultWithRelativeBitmaps,
|
|
1063
1058
|
};
|
|
1064
1059
|
return newConfig;
|
|
1065
1060
|
}
|
package/src/types.ts
CHANGED
package/tests/constants-e2e.ts
CHANGED
|
@@ -789,6 +789,10 @@ export const Tokens: {
|
|
|
789
789
|
address: '0x6bB7A17AcC227fd1F6781D1EEDEAE01B42047eE0',
|
|
790
790
|
decimals: 18,
|
|
791
791
|
},
|
|
792
|
+
GRAIL: {
|
|
793
|
+
address: '0x3d9907f9a368ad0a51be60f7da3b97cf940982d8',
|
|
794
|
+
decimals: 18,
|
|
795
|
+
},
|
|
792
796
|
},
|
|
793
797
|
[Network.OPTIMISM]: {
|
|
794
798
|
DAI: {
|
|
@@ -1016,7 +1020,7 @@ export const Holders: {
|
|
|
1016
1020
|
USDCe: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6',
|
|
1017
1021
|
USDC: '0xa843392198862f98d17e3aa1421b08f2c2020cff',
|
|
1018
1022
|
OHM: '0xebce5f29ff5ca9aa330ebdf7ec6b5f474bff271e',
|
|
1019
|
-
USDT: '
|
|
1023
|
+
USDT: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6',
|
|
1020
1024
|
POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
|
|
1021
1025
|
FRAX: '0x59bf0545fca0e5ad48e13da269facd2e8c886ba4',
|
|
1022
1026
|
nUSD: '0x9dd329f5411466d9e0c488ff72519ca9fef0cb40',
|
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>
|