@paraswap/dex-lib 2.23.4-uni-v3-avalanche.3 → 2.24.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/build/abi/algebra/AlgebraPool.abi.json +727 -0
- package/build/abi/algebra/AlgebraQuoter.abi.json +138 -0
- package/build/abi/algebra/AlgebraStateMulticall.abi.json +801 -0
- package/build/dex/algebra/algebra-pool.d.ts +41 -0
- package/build/dex/algebra/algebra-pool.js +272 -0
- package/build/dex/algebra/algebra-pool.js.map +1 -0
- package/build/dex/algebra/algebra.d.ts +53 -0
- package/build/dex/algebra/algebra.js +460 -0
- package/build/dex/algebra/algebra.js.map +1 -0
- package/build/dex/algebra/config.d.ts +4 -0
- package/build/dex/algebra/config.js +41 -0
- package/build/dex/algebra/config.js.map +1 -0
- package/build/dex/algebra/lib/AlgebraMath.d.ts +13 -0
- package/build/dex/algebra/lib/AlgebraMath.js +440 -0
- package/build/dex/algebra/lib/AlgebraMath.js.map +1 -0
- package/build/dex/algebra/lib/AlgebraXUniV3.d.ts +5 -0
- package/build/dex/algebra/lib/AlgebraXUniV3.js +45 -0
- package/build/dex/algebra/lib/AlgebraXUniV3.js.map +1 -0
- package/build/dex/algebra/lib/Constants.d.ts +5 -0
- package/build/dex/algebra/lib/Constants.js +10 -0
- package/build/dex/algebra/lib/Constants.js.map +1 -0
- package/build/dex/algebra/lib/DataStorage.d.ts +19 -0
- package/build/dex/algebra/lib/DataStorage.js +466 -0
- package/build/dex/algebra/lib/DataStorage.js.map +1 -0
- package/build/dex/algebra/lib/DataStorageOperator.d.ts +10 -0
- package/build/dex/algebra/lib/DataStorageOperator.js +93 -0
- package/build/dex/algebra/lib/DataStorageOperator.js.map +1 -0
- package/build/dex/algebra/lib/Sqrt.d.ts +3 -0
- package/build/dex/algebra/lib/Sqrt.js +60 -0
- package/build/dex/algebra/lib/Sqrt.js.map +1 -0
- package/build/dex/algebra/lib/TickManager.d.ts +10 -0
- package/build/dex/algebra/lib/TickManager.js +3 -0
- package/build/dex/algebra/lib/TickManager.js.map +1 -0
- package/build/dex/algebra/types.d.ts +75 -0
- package/build/dex/{pancakeswap-v3 → algebra}/types.js.map +1 -1
- package/build/dex/algebra/utils.d.ts +4 -0
- package/build/dex/algebra/utils.js +60 -0
- package/build/dex/algebra/utils.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +5 -5
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +0 -71
- 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/dex/aave-v3/tokens/arbitrum.json +0 -50
- package/build/dex/aave-v3/tokens/avalanche.json +0 -74
- package/build/dex/aave-v3/tokens/fantom.json +0 -62
- package/build/dex/aave-v3/tokens/optimism.json +0 -50
- package/build/dex/aave-v3/tokens/polygon.json +0 -116
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- 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/{pancakeswap-v3 → algebra}/types.js +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sqrt = void 0;
|
|
4
|
+
const utils_1 = require("../../../utils");
|
|
5
|
+
// TO COMPARE WITH https://github.com/cryptoalgebra/Algebra/blob/509f5bbb80b81daef1d5c15ea8695b5d039630cc/src/core/contracts/libraries/Sqrt.sol#L2-L3
|
|
6
|
+
class Sqrt {
|
|
7
|
+
/// @notice Gets the square root of the absolute value of the parameter
|
|
8
|
+
static sqrtAbs(_x) {
|
|
9
|
+
let result;
|
|
10
|
+
// get abs value
|
|
11
|
+
let mask = _x >> (256n - 1n);
|
|
12
|
+
let x = (0, utils_1.uint256)((_x ^ mask) - mask);
|
|
13
|
+
if (x == 0n)
|
|
14
|
+
result = 0n;
|
|
15
|
+
else {
|
|
16
|
+
let xx = x;
|
|
17
|
+
let r = 1n;
|
|
18
|
+
if (xx >= 0x100000000000000000000000000000000n) {
|
|
19
|
+
xx >>= 128n;
|
|
20
|
+
r <<= 64n;
|
|
21
|
+
}
|
|
22
|
+
if (xx >= 0x10000000000000000n) {
|
|
23
|
+
xx >>= 64n;
|
|
24
|
+
r <<= 32n;
|
|
25
|
+
}
|
|
26
|
+
Sqrt;
|
|
27
|
+
if (xx >= 0x100000000n) {
|
|
28
|
+
xx >>= 32n;
|
|
29
|
+
r <<= 16n;
|
|
30
|
+
}
|
|
31
|
+
if (xx >= 0x10000n) {
|
|
32
|
+
xx >>= 16n;
|
|
33
|
+
r <<= 8n;
|
|
34
|
+
}
|
|
35
|
+
if (xx >= 0x100n) {
|
|
36
|
+
xx >>= 8n;
|
|
37
|
+
r <<= 4n;
|
|
38
|
+
}
|
|
39
|
+
if (xx >= 0x10n) {
|
|
40
|
+
xx >>= 4n;
|
|
41
|
+
r <<= 2n;
|
|
42
|
+
}
|
|
43
|
+
if (xx >= 0x8n) {
|
|
44
|
+
r <<= 1n;
|
|
45
|
+
}
|
|
46
|
+
r = (r + x / r) >> 1n;
|
|
47
|
+
r = (r + x / r) >> 1n;
|
|
48
|
+
r = (r + x / r) >> 1n;
|
|
49
|
+
r = (r + x / r) >> 1n;
|
|
50
|
+
r = (r + x / r) >> 1n;
|
|
51
|
+
r = (r + x / r) >> 1n;
|
|
52
|
+
r = (r + x / r) >> 1n; // @dev Seven iterations should be enough.
|
|
53
|
+
let r1 = x / r;
|
|
54
|
+
result = r < r1 ? r : r1;
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Sqrt = Sqrt;
|
|
60
|
+
//# sourceMappingURL=Sqrt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sqrt.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/Sqrt.ts"],"names":[],"mappings":";;;AAAA,0CAAyC;AAEzC,qJAAqJ;AACrJ,MAAa,IAAI;IACf,uEAAuE;IACvE,MAAM,CAAC,OAAO,CAAC,EAAU;QACvB,IAAI,MAAM,CAAC;QAEX,gBAAgB;QAChB,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,IAAA,eAAO,EAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,EAAE;YAAE,MAAM,GAAG,EAAE,CAAC;aACpB;YACH,IAAI,EAAE,GAAG,CAAC,CAAC;YACX,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,IAAI,EAAE,IAAI,oCAAoC,EAAE;gBAC9C,EAAE,KAAK,IAAI,CAAC;gBACZ,CAAC,KAAK,GAAG,CAAC;aACX;YACD,IAAI,EAAE,IAAI,oBAAoB,EAAE;gBAC9B,EAAE,KAAK,GAAG,CAAC;gBACX,CAAC,KAAK,GAAG,CAAC;aACX;YACD,IAAI,CAAC;YACL,IAAI,EAAE,IAAI,YAAY,EAAE;gBACtB,EAAE,KAAK,GAAG,CAAC;gBACX,CAAC,KAAK,GAAG,CAAC;aACX;YACD,IAAI,EAAE,IAAI,QAAQ,EAAE;gBAClB,EAAE,KAAK,GAAG,CAAC;gBACX,CAAC,KAAK,EAAE,CAAC;aACV;YACD,IAAI,EAAE,IAAI,MAAM,EAAE;gBAChB,EAAE,KAAK,EAAE,CAAC;gBACV,CAAC,KAAK,EAAE,CAAC;aACV;YACD,IAAI,EAAE,IAAI,KAAK,EAAE;gBACf,EAAE,KAAK,EAAE,CAAC;gBACV,CAAC,KAAK,EAAE,CAAC;aACV;YACD,IAAI,EAAE,IAAI,IAAI,EAAE;gBACd,CAAC,KAAK,EAAE,CAAC;aACV;YACD,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,0CAA0C;YACjE,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1B;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArDD,oBAqDC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type Tick = {
|
|
2
|
+
liquidityTotal: bigint;
|
|
3
|
+
liquidityDelta: bigint;
|
|
4
|
+
outerFeeGrowth0Token: bigint;
|
|
5
|
+
outerFeeGrowth1Token: bigint;
|
|
6
|
+
outerTickCumulative: bigint;
|
|
7
|
+
outerSecondsPerLiquidity: bigint;
|
|
8
|
+
outerSecondsSpent: bigint;
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TickManager.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/TickManager.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import { Address, NumberAsString } from '../../types';
|
|
3
|
+
import { TickInfo } from '../uniswap-v3/types';
|
|
4
|
+
declare type GlobalState = {
|
|
5
|
+
price: bigint;
|
|
6
|
+
tick: bigint;
|
|
7
|
+
fee: bigint;
|
|
8
|
+
communityFeeToken0: bigint;
|
|
9
|
+
communityFeeToken1: bigint;
|
|
10
|
+
};
|
|
11
|
+
export declare type PoolState = {
|
|
12
|
+
pool: string;
|
|
13
|
+
blockTimestamp: bigint;
|
|
14
|
+
tickSpacing: bigint;
|
|
15
|
+
globalState: GlobalState;
|
|
16
|
+
liquidity: bigint;
|
|
17
|
+
maxLiquidityPerTick: bigint;
|
|
18
|
+
tickBitmap: Record<NumberAsString, bigint>;
|
|
19
|
+
ticks: Record<NumberAsString, TickInfo>;
|
|
20
|
+
isValid: boolean;
|
|
21
|
+
startTickBitmap: bigint;
|
|
22
|
+
balance0: bigint;
|
|
23
|
+
balance1: bigint;
|
|
24
|
+
};
|
|
25
|
+
export declare type AlgebraData = {
|
|
26
|
+
path: {
|
|
27
|
+
tokenIn: Address;
|
|
28
|
+
tokenOut: Address;
|
|
29
|
+
}[];
|
|
30
|
+
isApproved?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare type DexParams = {
|
|
33
|
+
router: Address;
|
|
34
|
+
quoter: Address;
|
|
35
|
+
factory: Address;
|
|
36
|
+
algebraStateMulticall: Address;
|
|
37
|
+
uniswapMulticall: Address;
|
|
38
|
+
chunksCount: number;
|
|
39
|
+
deployer: Address;
|
|
40
|
+
subgraphURL: string;
|
|
41
|
+
initHash: string;
|
|
42
|
+
};
|
|
43
|
+
export declare type TickBitMapMappingsWithBigNumber = {
|
|
44
|
+
index: number;
|
|
45
|
+
value: BigNumber;
|
|
46
|
+
};
|
|
47
|
+
export declare type TickInfoWithBigNumber = {
|
|
48
|
+
initialized: boolean;
|
|
49
|
+
liquidityGross: BigNumber;
|
|
50
|
+
liquidityNet: BigNumber;
|
|
51
|
+
secondsOutside: number;
|
|
52
|
+
secondsPerLiquidityOutsideX128: BigNumber;
|
|
53
|
+
tickCumulativeOutside: BigNumber;
|
|
54
|
+
};
|
|
55
|
+
export declare type TickInfoMappingsWithBigNumber = {
|
|
56
|
+
index: number;
|
|
57
|
+
value: TickInfoWithBigNumber;
|
|
58
|
+
};
|
|
59
|
+
export declare type DecodedStateMultiCallResultWithRelativeBitmaps = {
|
|
60
|
+
pool: Address;
|
|
61
|
+
blockTimestamp: BigNumber;
|
|
62
|
+
globalState: {
|
|
63
|
+
price: BigNumber;
|
|
64
|
+
tick: number;
|
|
65
|
+
fee: number;
|
|
66
|
+
communityFeeToken1: number;
|
|
67
|
+
communityFeeToken0: number;
|
|
68
|
+
};
|
|
69
|
+
liquidity: BigNumber;
|
|
70
|
+
tickSpacing: number;
|
|
71
|
+
maxLiquidityPerTick: BigNumber;
|
|
72
|
+
tickBitmap: TickBitMapMappingsWithBigNumber[];
|
|
73
|
+
ticks: TickInfoMappingsWithBigNumber[];
|
|
74
|
+
};
|
|
75
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/algebra/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BytesLike } from 'ethers';
|
|
2
|
+
import { MultiResult } from '../../lib/multi-wrapper';
|
|
3
|
+
import { DecodedStateMultiCallResultWithRelativeBitmaps } from './types';
|
|
4
|
+
export declare function decodeStateMultiCallResultWithRelativeBitmaps(result: MultiResult<BytesLike> | BytesLike): DecodedStateMultiCallResultWithRelativeBitmaps;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeStateMultiCallResultWithRelativeBitmaps = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const ts_essentials_1 = require("ts-essentials");
|
|
6
|
+
const decoders_1 = require("../../lib/decoders");
|
|
7
|
+
function decodeStateMultiCallResultWithRelativeBitmaps(result) {
|
|
8
|
+
const [isSuccess, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
|
|
9
|
+
(0, ts_essentials_1.assert)(isSuccess && toDecode !== '0x', `decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`);
|
|
10
|
+
const decoded = ethers_1.ethers.utils.defaultAbiCoder.decode([
|
|
11
|
+
// I don't want to pass here any interface, so I just use it in ethers format
|
|
12
|
+
`
|
|
13
|
+
tuple(
|
|
14
|
+
address pool,
|
|
15
|
+
uint256 blockTimestamp,
|
|
16
|
+
tuple(
|
|
17
|
+
uint160 price,
|
|
18
|
+
int24 tick,
|
|
19
|
+
uint16 fee,
|
|
20
|
+
uint16 timepointIndex,
|
|
21
|
+
uint8 communityFeeToken0,
|
|
22
|
+
uint8 communityFeeToken1,
|
|
23
|
+
bool unlocked,
|
|
24
|
+
) globalState,
|
|
25
|
+
uint128 liquidity,
|
|
26
|
+
int24 tickSpacing,
|
|
27
|
+
uint128 maxLiquidityPerTick,
|
|
28
|
+
tuple(
|
|
29
|
+
bool initialized,
|
|
30
|
+
uint32 blockTimestamp,
|
|
31
|
+
int56 tickCumulative,
|
|
32
|
+
uint160 secondsPerLiquidityCumulative,
|
|
33
|
+
uint88 volatilityCumulative,
|
|
34
|
+
int24 averageTick,
|
|
35
|
+
uint144 volumePerLiquidityCumulative,
|
|
36
|
+
) timepoints,
|
|
37
|
+
tuple(
|
|
38
|
+
int16 index,
|
|
39
|
+
uint256 value,
|
|
40
|
+
)[] tickBitmap,
|
|
41
|
+
tuple(
|
|
42
|
+
int24 index,
|
|
43
|
+
tuple(
|
|
44
|
+
uint128 liquidityGross,
|
|
45
|
+
int128 liquidityNet,
|
|
46
|
+
int56 tickCumulativeOutside,
|
|
47
|
+
uint160 secondsPerLiquidityOutsideX128,
|
|
48
|
+
uint32 secondsOutside,
|
|
49
|
+
bool initialized,
|
|
50
|
+
) value,
|
|
51
|
+
)[] ticks
|
|
52
|
+
)
|
|
53
|
+
`,
|
|
54
|
+
], toDecode)[0];
|
|
55
|
+
// This conversion is not precise, because when we decode, we have more values
|
|
56
|
+
// But I typed only the ones that are used later
|
|
57
|
+
return decoded;
|
|
58
|
+
}
|
|
59
|
+
exports.decodeStateMultiCallResultWithRelativeBitmaps = decodeStateMultiCallResultWithRelativeBitmaps;
|
|
60
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/algebra/utils.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAC3C,iDAAuC;AACvC,iDAA4D;AAI5D,SAAgB,6CAA6C,CAC3D,MAA0C;IAE1C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,IAAA,iCAAsB,EAAC,MAAM,CAAC,CAAC;IAE7D,IAAA,sBAAM,EACJ,SAAS,IAAI,QAAQ,KAAK,IAAI,EAC9B,iFAAiF,MAAM,EAAE,CAC1F,CAAC;IAEF,MAAM,OAAO,GAAG,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CACjD;QACE,6EAA6E;QAC7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCC;KACF,EACD,QAAQ,CACT,CAAC,CAAC,CAAC,CAAC;IACL,8EAA8E;IAC9E,gDAAgD;IAChD,OAAO,OAAyD,CAAC;AACnE,CAAC;AA7DD,sGA6DC"}
|
package/package.json
CHANGED
|
@@ -333,15 +333,15 @@ describe('UniswapV3 E2E', () => {
|
|
|
333
333
|
],
|
|
334
334
|
[
|
|
335
335
|
{ name: 'WAVAX', sellAmount: '1000000000000000000', buyAmount: '500000', },
|
|
336
|
-
{ name: 'USDC', sellAmount: '1000000', buyAmount: '
|
|
336
|
+
{ name: 'USDC', sellAmount: '1000000', buyAmount: '20000000000000000', },
|
|
337
337
|
],
|
|
338
338
|
[
|
|
339
|
-
{ name: 'WAVAX', sellAmount: '1000000000000000000', buyAmount: '
|
|
340
|
-
{ name: 'USDT', sellAmount: '1000000', buyAmount: '
|
|
339
|
+
{ name: 'WAVAX', sellAmount: '1000000000000000000', buyAmount: '10000000', },
|
|
340
|
+
{ name: 'USDT', sellAmount: '1000000', buyAmount: '2000000000000', },
|
|
341
341
|
],
|
|
342
342
|
[
|
|
343
|
-
{ name: 'USDC', sellAmount: '1000000', buyAmount: '
|
|
344
|
-
{ name: 'USDT', sellAmount: '
|
|
343
|
+
{ name: 'USDC', sellAmount: '1000000', buyAmount: '100000000', },
|
|
344
|
+
{ name: 'USDT', sellAmount: '100000000', buyAmount: '100000000', },
|
|
345
345
|
],
|
|
346
346
|
];
|
|
347
347
|
|
|
@@ -11,13 +11,6 @@ import { checkPoolPrices, checkPoolsLiquidity } from '../../../tests/utils';
|
|
|
11
11
|
import { Tokens } from '../../../tests/constants-e2e';
|
|
12
12
|
import UniswapV3QuoterABI from '../../abi/uniswap-v3/UniswapV3Quoter.abi.json';
|
|
13
13
|
import { Address } from '@paraswap/core';
|
|
14
|
-
import { uint256ToBigInt } from '../../lib/decoders';
|
|
15
|
-
import { decodeStateMultiCallResultWithRelativeBitmaps } from './utils';
|
|
16
|
-
import ERC20ABI from '../../abi/erc20.json';
|
|
17
|
-
import UniswapV3StateMulticallABI from '../../abi/uniswap-v3/UniswapV3StateMulticall.abi.json';
|
|
18
|
-
import { AbiItem } from 'web3-utils';
|
|
19
|
-
import { MultiCallParams } from '../../lib/multi-wrapper';
|
|
20
|
-
import { DecodedStateMultiCallResultWithRelativeBitmaps } from './types';
|
|
21
14
|
|
|
22
15
|
const network = Network.POLYGON;
|
|
23
16
|
const TokenASymbol = 'USDC';
|
|
@@ -151,70 +144,6 @@ describe('UniswapV3', function () {
|
|
|
151
144
|
);
|
|
152
145
|
});
|
|
153
146
|
|
|
154
|
-
it('test multiwrap', async () => {
|
|
155
|
-
|
|
156
|
-
const dexHelper = new DummyDexHelper(Network.AVALANCHE);
|
|
157
|
-
const blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
158
|
-
const erc20Interface = new Interface(ERC20ABI);
|
|
159
|
-
const stateMultiContract = new dexHelper.web3Provider.eth.Contract(
|
|
160
|
-
UniswapV3StateMulticallABI as AbiItem[],
|
|
161
|
-
'0x30F6B9b6485ff0B67E881f5ac80D3F1c70A4B23d',
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const calldata: MultiCallParams<
|
|
165
|
-
bigint | DecodedStateMultiCallResultWithRelativeBitmaps
|
|
166
|
-
>[] = [
|
|
167
|
-
{
|
|
168
|
-
target: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
|
|
169
|
-
callData: erc20Interface.encodeFunctionData('balanceOf', [
|
|
170
|
-
'0xfAe3f424a0a47706811521E3ee268f00cFb5c45E',
|
|
171
|
-
]),
|
|
172
|
-
decodeFunction: uint256ToBigInt,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
target: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
|
|
176
|
-
callData: erc20Interface.encodeFunctionData('balanceOf', [
|
|
177
|
-
'0xfAe3f424a0a47706811521E3ee268f00cFb5c45E',
|
|
178
|
-
]),
|
|
179
|
-
decodeFunction: uint256ToBigInt,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
target: stateMultiContract.options.address,
|
|
183
|
-
callData: stateMultiContract.methods
|
|
184
|
-
.getFullStateWithRelativeBitmaps(
|
|
185
|
-
'0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD',
|
|
186
|
-
'0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
|
|
187
|
-
'0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
|
|
188
|
-
500n,
|
|
189
|
-
12n,
|
|
190
|
-
12n,
|
|
191
|
-
)
|
|
192
|
-
.encodeABI(),
|
|
193
|
-
decodeFunction: decodeStateMultiCallResultWithRelativeBitmaps,
|
|
194
|
-
},
|
|
195
|
-
];
|
|
196
|
-
|
|
197
|
-
let readerResult;
|
|
198
|
-
try {
|
|
199
|
-
console.log('MUTLTO CALL V2 ADDRES: ', dexHelper.multiContract.options.address);
|
|
200
|
-
console.log('STATE UNI V3 MULTI CALL: ', stateMultiContract.options.address);
|
|
201
|
-
console.log('CALLDATA: ', JSON.stringify(calldata));
|
|
202
|
-
readerResult = (
|
|
203
|
-
await dexHelper.multiContract.methods
|
|
204
|
-
.tryAggregate(false, calldata)
|
|
205
|
-
.call(undefined, blockNumber)
|
|
206
|
-
);
|
|
207
|
-
} catch (e) {
|
|
208
|
-
console.log(
|
|
209
|
-
e,
|
|
210
|
-
);
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
console.log('READER RESULT: ', readerResult);
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
|
|
218
147
|
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
219
148
|
const pools = await uniswapV3.getPoolIdentifiers(
|
|
220
149
|
TokenA,
|
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>
|
package/.idea/vcs.xml
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"aSymbol": "aArbDAI",
|
|
4
|
-
"aAddress": "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
|
|
5
|
-
"address": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
|
|
6
|
-
"decimals": 18
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"aSymbol": "aArbEURS",
|
|
10
|
-
"aAddress": "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
|
|
11
|
-
"address": "0xd22a58f79e9481d1a88e00c343885a588b34b68b",
|
|
12
|
-
"decimals": 2
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"aSymbol": "aArbUSDC",
|
|
16
|
-
"aAddress": "0x625E7708f30cA75bfd92586e17077590C60eb4cD",
|
|
17
|
-
"address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
18
|
-
"decimals": 6
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"aSymbol": "aArbUSDT",
|
|
22
|
-
"aAddress": "0x6ab707aca953edaefbc4fd23ba73294241490620",
|
|
23
|
-
"address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
24
|
-
"decimals": 6
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"aSymbol": "aArbAAVE",
|
|
28
|
-
"aAddress": "0xf329e36C7bF6E5E86ce2150875a84Ce77f477375",
|
|
29
|
-
"address": "0xba5ddd1f9d7f570dc94a51479a000e3bce967196",
|
|
30
|
-
"decimals": 18
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"aSymbol": "aArbLINK",
|
|
34
|
-
"aAddress": "0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530",
|
|
35
|
-
"address": "0xf97f4df75117a78c1a5a0dbb814af92458539fb4",
|
|
36
|
-
"decimals": 18
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"aSymbol": "aArbWBTC",
|
|
40
|
-
"aAddress": "0x078f358208685046a11C85e8ad32895DED33A249",
|
|
41
|
-
"address": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
|
|
42
|
-
"decimals": 8
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"aSymbol": "aArbWETH",
|
|
46
|
-
"aAddress": "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
|
|
47
|
-
"address": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
48
|
-
"decimals": 18
|
|
49
|
-
}
|
|
50
|
-
]
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"aSymbol": "aAvaDAI",
|
|
4
|
-
"aAddress": "0x82e64f49ed5ec1bc6e43dad4fc8af9bb3a2312ee",
|
|
5
|
-
"address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70",
|
|
6
|
-
"decimals": 18
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"aSymbol": "aAvaFRAX",
|
|
10
|
-
"aAddress": "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA",
|
|
11
|
-
"address": "0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64",
|
|
12
|
-
"decimals": 18
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"aSymbol": "aAvaMAI",
|
|
16
|
-
"aAddress": "0x8Eb270e296023E9D92081fdF967dDd7878724424",
|
|
17
|
-
"address": "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b",
|
|
18
|
-
"decimals": 18
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"aSymbol": "aAvaUSDC",
|
|
22
|
-
"aAddress": "0x625e7708f30ca75bfd92586e17077590c60eb4cd",
|
|
23
|
-
"address": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
24
|
-
"decimals": 6
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"aSymbol": "aAvaUSDT",
|
|
28
|
-
"aAddress": "0x6ab707aca953edaefbc4fd23ba73294241490620",
|
|
29
|
-
"address": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
|
|
30
|
-
"decimals": 6
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"aSymbol": "aAvaAAVE",
|
|
34
|
-
"aAddress": "0xf329e36c7bf6e5e86ce2150875a84ce77f477375",
|
|
35
|
-
"address": "0x63a72806098bd3d9520cc43356dd78afe5d386d9",
|
|
36
|
-
"decimals": 18
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"aSymbol": "aAvaBTC.b",
|
|
40
|
-
"aAddress": "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692",
|
|
41
|
-
"address": "0x152b9d0FdC40C096757F570A51E494bd4b943E50",
|
|
42
|
-
"decimals": 8
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"aSymbol": "aAvaLINK",
|
|
46
|
-
"aAddress": "0x191c10aa4af7c30e871e70c95db0e4eb77237530",
|
|
47
|
-
"address": "0x5947bb275c521040051d82396192181b413227a3",
|
|
48
|
-
"decimals": 18
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"aSymbol": "aAvaSAVAX",
|
|
52
|
-
"aAddress": "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf",
|
|
53
|
-
"address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE",
|
|
54
|
-
"decimals": 18
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"aSymbol": "aAvaWAVAX",
|
|
58
|
-
"aAddress": "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
|
|
59
|
-
"address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
60
|
-
"decimals": 18
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"aSymbol": "aAvaWBTC",
|
|
64
|
-
"aAddress": "0x078f358208685046a11c85e8ad32895ded33a249",
|
|
65
|
-
"address": "0x50b7545627a5162f82a992c33b87adc75187b218",
|
|
66
|
-
"decimals": 8
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"aSymbol": "aAvaWETH",
|
|
70
|
-
"aAddress": "0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8",
|
|
71
|
-
"address": "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab",
|
|
72
|
-
"decimals": 18
|
|
73
|
-
}
|
|
74
|
-
]
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"aSymbol": "aFanAAVE",
|
|
4
|
-
"aAddress": "0xf329e36c7bf6e5e86ce2150875a84ce77f477375",
|
|
5
|
-
"address": "0x6a07a792ab2965c72a5b8088d3a069a7ac3a993b",
|
|
6
|
-
"decimals": 18
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"aSymbol": "aFanDAI",
|
|
10
|
-
"aAddress": "0x82e64f49ed5ec1bc6e43dad4fc8af9bb3a2312ee",
|
|
11
|
-
"address": "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e",
|
|
12
|
-
"decimals": 18
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"aSymbol": "aFanUSDT",
|
|
16
|
-
"aAddress": "0x6ab707aca953edaefbc4fd23ba73294241490620",
|
|
17
|
-
"address": "0x049d68029688eabf473097a2fc38ef61633a3c7a",
|
|
18
|
-
"decimals": 6
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"aSymbol": "aFanLINK",
|
|
22
|
-
"aAddress": "0x191c10aa4af7c30e871e70c95db0e4eb77237530",
|
|
23
|
-
"address": "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8",
|
|
24
|
-
"decimals": 18
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"aSymbol": "aFanWFTM",
|
|
28
|
-
"aAddress": "0x6d80113e533a2c0fe82eabd35f1875dcea89ea97",
|
|
29
|
-
"address": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
|
|
30
|
-
"decimals": 18
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"aSymbol": "aFanUSDC",
|
|
34
|
-
"aAddress": "0x625e7708f30ca75bfd92586e17077590c60eb4cd",
|
|
35
|
-
"address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
|
|
36
|
-
"decimals": 6
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"aSymbol": "aFanWBTC",
|
|
40
|
-
"aAddress": "0x078f358208685046a11c85e8ad32895ded33a249",
|
|
41
|
-
"address": "0x321162cd933e2be498cd2267a90534a804051b11",
|
|
42
|
-
"decimals": 8
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"aSymbol": "aFanWETH",
|
|
46
|
-
"aAddress": "0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8",
|
|
47
|
-
"address": "0x74b23882a30290451a17c44f4f05243b6b58c76d",
|
|
48
|
-
"decimals": 18
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"aSymbol": "aFanCRV",
|
|
52
|
-
"aAddress": "0x513c7e3a9c69ca3e22550ef58ac1c0088e918fff",
|
|
53
|
-
"address": "0x1e4f97b9f9f913c46f1632781732927b9019c68b",
|
|
54
|
-
"decimals": 18
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"aSymbol": "aFanSUSHI",
|
|
58
|
-
"aAddress": "0xc45a479877e1e9dfe9fcd4056c699575a1045daa",
|
|
59
|
-
"address": "0xae75a438b2e0cb8bb01ec1e1e376de11d44477cc",
|
|
60
|
-
"decimals": 18
|
|
61
|
-
}
|
|
62
|
-
]
|