@paraswap/dex-lib 2.28.10-ramses-v2 → 2.28.10
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/abi/uniswap-v3/UniswapV3QuoterV2.abi.json +155 -0
- package/build/dex/index.js +0 -2
- package/build/dex/index.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 +5 -9
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/lib/multi-wrapper.js +3 -5
- package/build/lib/multi-wrapper.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/index.ts +0 -2
- 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 +3 -26
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +4 -9
- package/src/dex/uniswap-v3/uniswap-v3.ts +4 -9
- package/src/lib/multi-wrapper.ts +4 -4
- package/tests/constants-e2e.ts +5 -1
- package/src/abi/RamsesV2Pool.abi.json +0 -1554
- package/src/abi/RamsesV2StateMulticall.abi.json +0 -891
- package/src/dex/ramses-v2/config.ts +0 -31
- package/src/dex/ramses-v2/constants.ts +0 -41
- package/src/dex/ramses-v2/contract-math/BitMath.ts +0 -90
- package/src/dex/ramses-v2/contract-math/FixedPoint128.ts +0 -3
- package/src/dex/ramses-v2/contract-math/FixedPoint96.ts +0 -4
- package/src/dex/ramses-v2/contract-math/FullMath.ts +0 -30
- package/src/dex/ramses-v2/contract-math/LiquidityMath.ts +0 -17
- package/src/dex/ramses-v2/contract-math/Oracle.ts +0 -226
- package/src/dex/ramses-v2/contract-math/SqrtPriceMath.ts +0 -226
- package/src/dex/ramses-v2/contract-math/SwapMath.ts +0 -139
- package/src/dex/ramses-v2/contract-math/Tick.ts +0 -82
- package/src/dex/ramses-v2/contract-math/TickBitMap.ts +0 -128
- package/src/dex/ramses-v2/contract-math/TickMath.ts +0 -211
- package/src/dex/ramses-v2/contract-math/UnsafeMath.ts +0 -5
- package/src/dex/ramses-v2/contract-math/uniswap-v3-math.ts +0 -666
- package/src/dex/ramses-v2/contract-math/utils.ts +0 -11
- package/src/dex/ramses-v2/ramses-v2-e2e.test.ts +0 -100
- package/src/dex/ramses-v2/ramses-v2-events.test.ts +0 -182
- package/src/dex/ramses-v2/ramses-v2-integration.test.ts +0 -462
- package/src/dex/ramses-v2/ramses-v2-pool.ts +0 -513
- package/src/dex/ramses-v2/ramses-v2.ts +0 -1136
- package/src/dex/ramses-v2/types.ts +0 -177
- package/src/dex/ramses-v2/utils.ts +0 -90
- package/src/dex/uniswap-v3/forks/ramses-v2/utils.ts +0 -72
|
@@ -88,18 +88,8 @@ async function checkOnChainPricing(
|
|
|
88
88
|
return false;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
// const readerCallData = getReaderCalldata(
|
|
92
|
-
// exchangeAddress,
|
|
93
|
-
// readerIface,
|
|
94
|
-
// _amounts.slice(1),
|
|
95
|
-
// funcName,
|
|
96
|
-
// tokenIn,
|
|
97
|
-
// tokenOut,
|
|
98
|
-
// fee,
|
|
99
|
-
// );
|
|
100
|
-
|
|
101
91
|
const readerCallData = getReaderCalldata(
|
|
102
|
-
|
|
92
|
+
exchangeAddress,
|
|
103
93
|
readerIface,
|
|
104
94
|
_amounts.slice(1),
|
|
105
95
|
funcName,
|
|
@@ -148,22 +138,9 @@ describe('UniswapV3', function () {
|
|
|
148
138
|
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
149
139
|
uniswapV3 = new UniswapV3(network, dexKey, dexHelper);
|
|
150
140
|
uniswapV3Mainnet = new UniswapV3(
|
|
151
|
-
Network.
|
|
141
|
+
Network.MAINNET,
|
|
152
142
|
dexKey,
|
|
153
|
-
new DummyDexHelper(Network.
|
|
154
|
-
);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
it('fgggg', async () => {
|
|
159
|
-
const readerCallData = getReaderCalldata(
|
|
160
|
-
'',
|
|
161
|
-
readerIface,
|
|
162
|
-
_amounts.slice(1),
|
|
163
|
-
funcName,
|
|
164
|
-
tokenIn,
|
|
165
|
-
tokenOut,
|
|
166
|
-
fee,
|
|
143
|
+
new DummyDexHelper(Network.MAINNET),
|
|
167
144
|
);
|
|
168
145
|
});
|
|
169
146
|
|
|
@@ -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;
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import { UniswapV3Config, Adapters, PoolsToPreload } from './config';
|
|
43
43
|
import { UniswapV3EventPool } from './uniswap-v3-pool';
|
|
44
44
|
import UniswapV3RouterABI from '../../abi/uniswap-v3/UniswapV3Router.abi.json';
|
|
45
|
-
import
|
|
45
|
+
import UniswapV3QuoterV2ABI from '../../abi/uniswap-v3/UniswapV3QuoterV2.abi.json';
|
|
46
46
|
import UniswapV3MultiABI from '../../abi/uniswap-v3/UniswapMulti.abi.json';
|
|
47
47
|
import DirectSwapABI from '../../abi/DirectSwap.json';
|
|
48
48
|
import UniswapV3StateMulticallABI from '../../abi/uniswap-v3/UniswapV3StateMulticall.abi.json';
|
|
@@ -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;
|
|
@@ -107,7 +107,7 @@ export class UniswapV3
|
|
|
107
107
|
protected dexHelper: IDexHelper,
|
|
108
108
|
protected adapters = Adapters[network] || {},
|
|
109
109
|
readonly routerIface = new Interface(UniswapV3RouterABI),
|
|
110
|
-
readonly quoterIface = new Interface(
|
|
110
|
+
readonly quoterIface = new Interface(UniswapV3QuoterV2ABI),
|
|
111
111
|
protected config = UniswapV3Config[dexKey][network],
|
|
112
112
|
protected poolsToPreload = PoolsToPreload[dexKey]?.[network] || [],
|
|
113
113
|
) {
|
|
@@ -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/lib/multi-wrapper.ts
CHANGED
|
@@ -65,11 +65,11 @@ export class MultiWrapper {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const aggregatedResult = await Promise.all(
|
|
68
|
-
allCalls.map(batch =>
|
|
69
|
-
|
|
68
|
+
allCalls.map(batch =>
|
|
69
|
+
this.multi.methods
|
|
70
70
|
.tryAggregate(mandatory, batch)
|
|
71
|
-
.call(undefined, blockNumber)
|
|
72
|
-
|
|
71
|
+
.call(undefined, blockNumber),
|
|
72
|
+
),
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
let globalInd = 0;
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -785,6 +785,10 @@ export const Tokens: {
|
|
|
785
785
|
address: '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f',
|
|
786
786
|
decimals: 8,
|
|
787
787
|
},
|
|
788
|
+
USDCe: {
|
|
789
|
+
address: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
|
|
790
|
+
decimals: 6,
|
|
791
|
+
},
|
|
788
792
|
LEX: {
|
|
789
793
|
address: '0x6bB7A17AcC227fd1F6781D1EEDEAE01B42047eE0',
|
|
790
794
|
decimals: 18,
|
|
@@ -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',
|