@paraswap/dex-lib 2.28.10 → 2.28.11-ramses-v2
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/uniswap-v3/config.js +22 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/forks/ramses-v2/utils.d.ts +1 -1
- package/build/dex/uniswap-v3/types.d.ts +6 -1
- package/build/dex/uniswap-v3/types.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +3 -2
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +5 -2
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +7 -3
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/RamsesV2Pool.abi.json +1554 -0
- package/src/abi/RamsesV2Quoter.abi.json +274 -0
- package/src/abi/RamsesV2StateMulticall.abi.json +891 -0
- package/src/dex/uniswap-v3/config.ts +22 -0
- package/src/dex/uniswap-v3/forks/ramses-v2/utils.ts +72 -0
- package/src/dex/uniswap-v3/types.ts +7 -1
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +445 -354
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +171 -13
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +9 -4
- package/src/dex/uniswap-v3/uniswap-v3.ts +7 -2
- package/tests/constants-e2e.ts +1 -5
|
@@ -2,6 +2,9 @@ import { DexParams } from './types';
|
|
|
2
2
|
import { DexConfigMap, AdapterMappings } from '../../types';
|
|
3
3
|
import { Network, SwapSide } from '../../constants';
|
|
4
4
|
import { Address } from '../../types';
|
|
5
|
+
import RamsesV2StateMulticallABI from '../../abi/RamsesV2StateMulticall.abi.json';
|
|
6
|
+
import { AbiItem } from 'web3-utils';
|
|
7
|
+
import { decodeStateMultiCallResultWithRelativeBitmaps } from './forks/ramses-v2/utils';
|
|
5
8
|
|
|
6
9
|
const SUPPORTED_FEES = [10000n, 3000n, 500n, 100n];
|
|
7
10
|
|
|
@@ -104,6 +107,25 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
|
|
|
104
107
|
'https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax',
|
|
105
108
|
},
|
|
106
109
|
},
|
|
110
|
+
RamsesV2: {
|
|
111
|
+
[Network.ARBITRUM]: {
|
|
112
|
+
factory: '0xAA2cd7477c451E703f3B9Ba5663334914763edF8',
|
|
113
|
+
deployer: '0xb3e423ab9cE6C03D98326A3A2a0D7D96b0829f22',
|
|
114
|
+
quoter: '0xAA20EFF7ad2F523590dE6c04918DaAE0904E3b20',
|
|
115
|
+
router: '0xAA23611badAFB62D37E7295A682D21960ac85A90',
|
|
116
|
+
supportedFees: SUPPORTED_FEES,
|
|
117
|
+
stateMulticall: '0x50EE4112Cab9c79812F23bE079aB3911395ACc8e',
|
|
118
|
+
stateMultiCallAbi: RamsesV2StateMulticallABI as AbiItem[],
|
|
119
|
+
uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
|
|
120
|
+
chunksCount: 10,
|
|
121
|
+
initRetryFrequency: 10,
|
|
122
|
+
decodeStateMultiCallResultWithRelativeBitmaps,
|
|
123
|
+
initHash:
|
|
124
|
+
'0x1565b129f2d1790f12d45301b9b084335626f0c92410bc43130763b69971135d',
|
|
125
|
+
subgraphURL:
|
|
126
|
+
'https://api.thegraph.com/subgraphs/name/ramsesexchange/concentrated-liquidity-graph',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
107
129
|
'QuickSwapV3.1': {
|
|
108
130
|
[Network.ZKEVM]: {
|
|
109
131
|
factory: '0xD9a2AD9E927Bd7014116CC5c7328f028D4318178',
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MultiResult } from '../../../../lib/multi-wrapper';
|
|
2
|
+
import { BytesLike, ethers } from 'ethers';
|
|
3
|
+
import { DecodedStateMultiCallResultWithRelativeBitmaps } from '../../types';
|
|
4
|
+
import { extractSuccessAndValue } from '../../../../lib/decoders';
|
|
5
|
+
import { assert } from 'ts-essentials';
|
|
6
|
+
|
|
7
|
+
export function decodeStateMultiCallResultWithRelativeBitmaps(
|
|
8
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
9
|
+
): DecodedStateMultiCallResultWithRelativeBitmaps {
|
|
10
|
+
const [isSuccess, toDecode] = extractSuccessAndValue(result);
|
|
11
|
+
|
|
12
|
+
assert(
|
|
13
|
+
isSuccess && toDecode !== '0x',
|
|
14
|
+
`decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const decoded = ethers.utils.defaultAbiCoder.decode(
|
|
18
|
+
[
|
|
19
|
+
// I don't want to pass here any interface, so I just use it in ethers format
|
|
20
|
+
`
|
|
21
|
+
tuple(
|
|
22
|
+
address pool,
|
|
23
|
+
uint256 blockTimestamp,
|
|
24
|
+
tuple(
|
|
25
|
+
uint160 sqrtPriceX96,
|
|
26
|
+
int24 tick,
|
|
27
|
+
uint16 observationIndex,
|
|
28
|
+
uint16 observationCardinality,
|
|
29
|
+
uint16 observationCardinalityNext,
|
|
30
|
+
uint8 feeProtocol,
|
|
31
|
+
bool unlocked,
|
|
32
|
+
) slot0,
|
|
33
|
+
uint128 liquidity,
|
|
34
|
+
int24 tickSpacing,
|
|
35
|
+
uint128 maxLiquidityPerTick,
|
|
36
|
+
tuple(
|
|
37
|
+
uint32 blockTimestamp,
|
|
38
|
+
int56 tickCumulative,
|
|
39
|
+
uint160 secondsPerLiquidityCumulativeX128,
|
|
40
|
+
bool initialized,
|
|
41
|
+
uint160 secondsPerBoostedLiquidityPeriodX128,
|
|
42
|
+
uint32 boostedInRange,
|
|
43
|
+
) observation,
|
|
44
|
+
tuple(
|
|
45
|
+
int16 index,
|
|
46
|
+
uint256 value
|
|
47
|
+
)[] tickBitmap,
|
|
48
|
+
tuple(
|
|
49
|
+
int24 index,
|
|
50
|
+
tuple(
|
|
51
|
+
uint128 liquidityGross,
|
|
52
|
+
int128 liquidityNet,
|
|
53
|
+
uint128 cleanUnusedSlot,
|
|
54
|
+
uint128 cleanUnusedSlot2,
|
|
55
|
+
uint256 feeGrowthOutside0X128,
|
|
56
|
+
uint256 feeGrowthOutside1X128,
|
|
57
|
+
int56 tickCumulativeOutside,
|
|
58
|
+
uint160 secondsPerLiquidityOutsideX128,
|
|
59
|
+
uint32 secondsOutside,
|
|
60
|
+
bool initialized,
|
|
61
|
+
) value,
|
|
62
|
+
)[] ticks
|
|
63
|
+
)
|
|
64
|
+
`,
|
|
65
|
+
],
|
|
66
|
+
toDecode,
|
|
67
|
+
)[0];
|
|
68
|
+
|
|
69
|
+
// This conversion is not precise, because when we decode, we have more values
|
|
70
|
+
// But I typed only the ones that are used later
|
|
71
|
+
return decoded as DecodedStateMultiCallResultWithRelativeBitmaps;
|
|
72
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers';
|
|
1
|
+
import { BigNumber, BytesLike } from 'ethers';
|
|
2
2
|
import { NumberAsString } from '../../types';
|
|
3
3
|
import { Address } from '../../types';
|
|
4
|
+
import { AbiItem } from 'web3-utils';
|
|
5
|
+
import { MultiResult } from '../../lib/multi-wrapper';
|
|
4
6
|
|
|
5
7
|
export type OracleObservation = {
|
|
6
8
|
blockTimestamp: bigint;
|
|
@@ -60,6 +62,8 @@ export type UniswapV3Data = {
|
|
|
60
62
|
isApproved?: boolean;
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
export type DecodeStateMultiCallFunc = (result: MultiResult<BytesLike> | BytesLike) => DecodedStateMultiCallResultWithRelativeBitmaps;
|
|
66
|
+
|
|
63
67
|
export type DexParams = {
|
|
64
68
|
router: Address;
|
|
65
69
|
quoter: Address;
|
|
@@ -72,6 +76,8 @@ export type DexParams = {
|
|
|
72
76
|
deployer?: Address;
|
|
73
77
|
subgraphURL: string;
|
|
74
78
|
initHash: string;
|
|
79
|
+
stateMultiCallAbi?: AbiItem[];
|
|
80
|
+
decodeStateMultiCallResultWithRelativeBitmaps? : DecodeStateMultiCallFunc,
|
|
75
81
|
};
|
|
76
82
|
|
|
77
83
|
export type UniswapV3SimpleSwapSellParam = {
|