@paraswap/dex-lib 2.16.8-pancakeswapv3.0 → 2.17.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/.idea/aws.xml +17 -0
- package/.idea/codeStyles/Project.xml +19 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/paraswap-dex-lib.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/build/abi/woo-fi/WooFeeManager.abi.json +318 -0
- package/build/abi/woo-fi/WooPP.abi.json +548 -0
- package/build/abi/woo-fi/Wooracle.abi.json +260 -0
- package/build/config.js +4 -4
- package/build/dex/aave-v3/tokens/arbitrum.json +50 -0
- package/build/dex/aave-v3/tokens/avalanche.json +74 -0
- package/build/dex/aave-v3/tokens/fantom.json +62 -0
- package/build/dex/aave-v3/tokens/optimism.json +50 -0
- package/build/dex/aave-v3/tokens/polygon.json +116 -0
- package/build/dex/balancer-v2/balancer-v2.d.ts +14 -19
- package/build/dex/balancer-v2/balancer-v2.js +27 -22
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/config.d.ts +2 -7
- package/build/dex/balancer-v2/config.js +20 -30
- package/build/dex/balancer-v2/config.js.map +1 -1
- package/build/dex/balancer-v2/pools/balancer-v2-pool.d.ts +25 -0
- package/build/dex/balancer-v2/pools/balancer-v2-pool.js +107 -0
- package/build/dex/balancer-v2/pools/balancer-v2-pool.js.map +1 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.d.ts +20 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.js +179 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.d.ts +50 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.js +458 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.js.map +1 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.d.ts +10 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.js +314 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.d.ts +50 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.js +367 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.js.map +1 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.d.ts +7 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.js +111 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.d.ts +30 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.js +129 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.js.map +1 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.d.ts +6 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.js +61 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.d.ts +30 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.js +112 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.js.map +1 -0
- package/build/dex/balancer-v2/types.d.ts +1 -0
- package/build/dex/balancer-v2/types.js.map +1 -1
- package/build/dex/balancer-v2/utils.d.ts +3 -2
- package/build/dex/balancer-v2/utils.js +6 -4
- package/build/dex/balancer-v2/utils.js.map +1 -1
- package/build/dex/index.js +1 -1
- package/build/dex/index.js.map +1 -1
- package/build/dex/quickswap-v3.d.ts +21 -0
- package/build/dex/quickswap-v3.js +40 -0
- package/build/dex/quickswap-v3.js.map +1 -0
- package/build/dex/uniswap-v3/config.js +28 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +2 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +3 -2
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/{pancakeswap-v3 → woo-fi}/config.d.ts +2 -2
- package/build/dex/woo-fi/config.js +141 -0
- package/build/dex/woo-fi/config.js.map +1 -0
- package/build/dex/woo-fi/constants.d.ts +5 -0
- package/build/dex/woo-fi/constants.js +20 -0
- package/build/dex/woo-fi/constants.js.map +1 -0
- package/build/dex/woo-fi/types.d.ts +48 -0
- package/build/dex/woo-fi/types.js +3 -0
- package/build/dex/woo-fi/types.js.map +1 -0
- package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +14 -0
- package/build/dex/woo-fi/woo-fi-decimal-math.js +42 -0
- package/build/dex/woo-fi/woo-fi-decimal-math.js.map +1 -0
- package/build/dex/woo-fi/woo-fi-math.d.ts +31 -0
- package/build/dex/woo-fi/woo-fi-math.js +300 -0
- package/build/dex/woo-fi/woo-fi-math.js.map +1 -0
- package/build/dex/woo-fi/woo-fi.d.ts +65 -0
- package/build/dex/woo-fi/woo-fi.js +480 -0
- package/build/dex/woo-fi/woo-fi.js.map +1 -0
- package/package.json +1 -1
- package/src/config.ts +4 -4
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +538 -225
- package/src/dex/balancer-v2/balancer-v2-integration.test.ts +305 -122
- package/src/dex/balancer-v2/balancer-v2.ts +60 -56
- package/src/dex/balancer-v2/config.ts +23 -35
- package/src/dex/balancer-v2/pools/balancer-v2-pool.ts +274 -0
- package/src/dex/balancer-v2/{LinearMath.ts → pools/linear/LinearMath.ts} +11 -10
- package/src/dex/balancer-v2/{LinearPool.ts → pools/linear/LinearPool.ts} +210 -6
- package/src/dex/balancer-v2/{StableMath.ts → pools/phantom-stable/PhantomStableMath.ts} +101 -21
- package/src/dex/balancer-v2/{PhantomStablePool.ts → pools/phantom-stable/PhantomStablePool.ts} +167 -12
- package/src/dex/balancer-v2/pools/stable/StableMath.ts +204 -0
- package/src/dex/balancer-v2/pools/stable/StablePool.ts +221 -0
- package/src/dex/balancer-v2/pools/weighted/WeightedMath.ts +84 -0
- package/src/dex/balancer-v2/pools/weighted/WeightedPool.ts +189 -0
- package/src/dex/balancer-v2/types.ts +1 -0
- package/src/dex/balancer-v2/utils.ts +7 -1
- package/src/dex/index.ts +1 -1
- package/src/dex/uniswap-v3/config.ts +32 -0
- package/src/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.ts +28 -0
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +156 -0
- package/src/dex/uniswap-v3/uniswap-v3-events.test.ts +0 -4
- package/src/dex/uniswap-v3/uniswap-v3-pool.ts +2 -1
- package/src/dex/uniswap-v3/uniswap-v3.ts +1 -0
- package/tests/constants-e2e.ts +33 -8
- package/build/abi/pancakeswap-v3/PancakeV3StateMulticall.abi.json +0 -781
- package/build/abi/pancakeswap-v3/PancakeswapV3Pool.abi.json +0 -1039
- package/build/abi/pancakeswap-v3/PancakeswapV3Quoter.abi.json +0 -285
- package/build/abi/pancakeswap-v3/PancakeswapV3Router.abi.json +0 -583
- package/build/dex/pancakeswap-v3/config.js +0 -62
- package/build/dex/pancakeswap-v3/config.js.map +0 -1
- package/build/dex/pancakeswap-v3/constants.d.ts +0 -23
- package/build/dex/pancakeswap-v3/constants.js +0 -29
- package/build/dex/pancakeswap-v3/constants.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/BitMath.d.ts +0 -4
- package/build/dex/pancakeswap-v3/contract-math/BitMath.js +0 -93
- package/build/dex/pancakeswap-v3/contract-math/BitMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint128.d.ts +0 -3
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint128.js +0 -8
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint128.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint96.d.ts +0 -4
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint96.js +0 -9
- package/build/dex/pancakeswap-v3/contract-math/FixedPoint96.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/FullMath.d.ts +0 -4
- package/build/dex/pancakeswap-v3/contract-math/FullMath.js +0 -19
- package/build/dex/pancakeswap-v3/contract-math/FullMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/LiquidityMath.d.ts +0 -3
- package/build/dex/pancakeswap-v3/contract-math/LiquidityMath.js +0 -22
- package/build/dex/pancakeswap-v3/contract-math/LiquidityMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/Oracle.d.ts +0 -10
- package/build/dex/pancakeswap-v3/contract-math/Oracle.js +0 -133
- package/build/dex/pancakeswap-v3/contract-math/Oracle.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/SqrtPriceMath.d.ts +0 -10
- package/build/dex/pancakeswap-v3/contract-math/SqrtPriceMath.js +0 -91
- package/build/dex/pancakeswap-v3/contract-math/SqrtPriceMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/SwapMath.d.ts +0 -8
- package/build/dex/pancakeswap-v3/contract-math/SwapMath.js +0 -70
- package/build/dex/pancakeswap-v3/contract-math/SwapMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/Tick.d.ts +0 -7
- package/build/dex/pancakeswap-v3/contract-math/Tick.js +0 -45
- package/build/dex/pancakeswap-v3/contract-math/Tick.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/TickBitMap.d.ts +0 -8
- package/build/dex/pancakeswap-v3/contract-math/TickBitMap.js +0 -87
- package/build/dex/pancakeswap-v3/contract-math/TickBitMap.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/TickMath.d.ts +0 -8
- package/build/dex/pancakeswap-v3/contract-math/TickMath.js +0 -162
- package/build/dex/pancakeswap-v3/contract-math/TickMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/UnsafeMath.d.ts +0 -3
- package/build/dex/pancakeswap-v3/contract-math/UnsafeMath.js +0 -10
- package/build/dex/pancakeswap-v3/contract-math/UnsafeMath.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.d.ts +0 -18
- package/build/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.js +0 -407
- package/build/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.js.map +0 -1
- package/build/dex/pancakeswap-v3/contract-math/utils.d.ts +0 -3
- package/build/dex/pancakeswap-v3/contract-math/utils.js +0 -16
- package/build/dex/pancakeswap-v3/contract-math/utils.js.map +0 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.d.ts +0 -45
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js +0 -340
- package/build/dex/pancakeswap-v3/pancakeswap-v3-pool.js.map +0 -1
- package/build/dex/pancakeswap-v3/pancakeswap-v3.d.ts +0 -55
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +0 -605
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js.map +0 -1
- package/build/dex/pancakeswap-v3/types.d.ts +0 -137
- package/build/dex/pancakeswap-v3/types.js +0 -9
- package/build/dex/pancakeswap-v3/types.js.map +0 -1
- package/build/dex/pancakeswap-v3/utils.d.ts +0 -6
- package/build/dex/pancakeswap-v3/utils.js +0 -65
- package/build/dex/pancakeswap-v3/utils.js.map +0 -1
- package/src/abi/pancakeswap-v3/PancakeV3StateMulticall.abi.json +0 -781
- package/src/abi/pancakeswap-v3/PancakeswapV3Pool.abi.json +0 -1039
- package/src/dex/balancer-v2/balancer-v2-pool.ts +0 -744
- package/src/dex/pancakeswap-v3/config.ts +0 -68
- package/src/dex/pancakeswap-v3/constants.ts +0 -35
- package/src/dex/pancakeswap-v3/contract-math/BitMath.ts +0 -90
- package/src/dex/pancakeswap-v3/contract-math/FixedPoint128.ts +0 -3
- package/src/dex/pancakeswap-v3/contract-math/FixedPoint96.ts +0 -4
- package/src/dex/pancakeswap-v3/contract-math/FullMath.ts +0 -30
- package/src/dex/pancakeswap-v3/contract-math/LiquidityMath.ts +0 -17
- package/src/dex/pancakeswap-v3/contract-math/Oracle.ts +0 -226
- package/src/dex/pancakeswap-v3/contract-math/SqrtPriceMath.ts +0 -226
- package/src/dex/pancakeswap-v3/contract-math/SwapMath.ts +0 -139
- package/src/dex/pancakeswap-v3/contract-math/Tick.ts +0 -82
- package/src/dex/pancakeswap-v3/contract-math/TickBitMap.ts +0 -128
- package/src/dex/pancakeswap-v3/contract-math/TickMath.ts +0 -211
- package/src/dex/pancakeswap-v3/contract-math/UnsafeMath.ts +0 -5
- package/src/dex/pancakeswap-v3/contract-math/pancakeswap-v3-math.ts +0 -691
- package/src/dex/pancakeswap-v3/contract-math/utils.ts +0 -11
- package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +0 -168
- package/src/dex/pancakeswap-v3/pancakeswap-v3-events.test.ts +0 -124
- package/src/dex/pancakeswap-v3/pancakeswap-v3-integration.test.ts +0 -338
- package/src/dex/pancakeswap-v3/pancakeswap-v3-pool.ts +0 -554
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +0 -1000
- /package/src/abi/{pancakeswap-v3/PancakeswapV3Quoter.abi.json → uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json} +0 -0
- /package/src/abi/{pancakeswap-v3 → uniswap-v3/pancakeswap-v3}/PancakeswapV3Router.abi.json +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers';
|
|
2
|
-
import { NumberAsString } from '../../types';
|
|
3
|
-
import { Address } from '../../types';
|
|
4
|
-
export declare type OracleObservation = {
|
|
5
|
-
blockTimestamp: bigint;
|
|
6
|
-
tickCumulative: bigint;
|
|
7
|
-
secondsPerLiquidityCumulativeX128: bigint;
|
|
8
|
-
initialized: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare type OracleObservationCandidates = {
|
|
11
|
-
beforeOrAt: OracleObservation;
|
|
12
|
-
atOrAfter: OracleObservation;
|
|
13
|
-
};
|
|
14
|
-
export declare type TickInfo = {
|
|
15
|
-
liquidityGross: bigint;
|
|
16
|
-
liquidityNet: bigint;
|
|
17
|
-
tickCumulativeOutside: bigint;
|
|
18
|
-
secondsPerLiquidityOutsideX128: bigint;
|
|
19
|
-
secondsOutside: bigint;
|
|
20
|
-
initialized: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare type Slot0 = {
|
|
23
|
-
sqrtPriceX96: bigint;
|
|
24
|
-
tick: bigint;
|
|
25
|
-
observationIndex: number;
|
|
26
|
-
observationCardinality: number;
|
|
27
|
-
observationCardinalityNext: number;
|
|
28
|
-
feeProtocol: bigint;
|
|
29
|
-
};
|
|
30
|
-
export declare type PoolState = {
|
|
31
|
-
pool: string;
|
|
32
|
-
blockTimestamp: bigint;
|
|
33
|
-
tickSpacing: bigint;
|
|
34
|
-
fee: bigint;
|
|
35
|
-
slot0: Slot0;
|
|
36
|
-
liquidity: bigint;
|
|
37
|
-
maxLiquidityPerTick: bigint;
|
|
38
|
-
tickBitmap: Record<NumberAsString, bigint>;
|
|
39
|
-
ticks: Record<NumberAsString, TickInfo>;
|
|
40
|
-
observations: Record<number, OracleObservation>;
|
|
41
|
-
isValid: boolean;
|
|
42
|
-
startTickBitmap: bigint;
|
|
43
|
-
lowestKnownTick: bigint;
|
|
44
|
-
highestKnownTick: bigint;
|
|
45
|
-
balance0: bigint;
|
|
46
|
-
balance1: bigint;
|
|
47
|
-
};
|
|
48
|
-
export declare type UniswapV3Data = {
|
|
49
|
-
path: {
|
|
50
|
-
tokenIn: Address;
|
|
51
|
-
tokenOut: Address;
|
|
52
|
-
fee: NumberAsString;
|
|
53
|
-
}[];
|
|
54
|
-
};
|
|
55
|
-
export declare type DexParams = {
|
|
56
|
-
router: Address;
|
|
57
|
-
quoter: Address;
|
|
58
|
-
factory: Address;
|
|
59
|
-
stateMulticall: Address;
|
|
60
|
-
uniswapMulticall: Address;
|
|
61
|
-
supportedFees: bigint[];
|
|
62
|
-
chunksCount: number;
|
|
63
|
-
deployer?: Address;
|
|
64
|
-
subgraphURL: string;
|
|
65
|
-
initHash: string;
|
|
66
|
-
};
|
|
67
|
-
export declare type UniswapV3SellParam = {
|
|
68
|
-
path: string;
|
|
69
|
-
recipient: Address;
|
|
70
|
-
deadline: string;
|
|
71
|
-
amountIn: NumberAsString;
|
|
72
|
-
amountOutMinimum: NumberAsString;
|
|
73
|
-
};
|
|
74
|
-
export declare type UniswapV3BuyParam = {
|
|
75
|
-
path: string;
|
|
76
|
-
recipient: Address;
|
|
77
|
-
deadline: string;
|
|
78
|
-
amountOut: NumberAsString;
|
|
79
|
-
amountInMaximum: NumberAsString;
|
|
80
|
-
};
|
|
81
|
-
export declare type UniswapV3Param = UniswapV3SellParam | UniswapV3BuyParam;
|
|
82
|
-
export declare enum UniswapV3Functions {
|
|
83
|
-
exactInput = "exactInput",
|
|
84
|
-
exactOutput = "exactOutput"
|
|
85
|
-
}
|
|
86
|
-
export declare type TickInfoMappings = {
|
|
87
|
-
index: number;
|
|
88
|
-
value: TickInfo;
|
|
89
|
-
};
|
|
90
|
-
export declare type TickBitMapMappings = {
|
|
91
|
-
index: number;
|
|
92
|
-
value: bigint;
|
|
93
|
-
};
|
|
94
|
-
export declare type OutputResult = {
|
|
95
|
-
outputs: bigint[];
|
|
96
|
-
tickCounts: number[];
|
|
97
|
-
};
|
|
98
|
-
export declare type TickBitMapMappingsWithBigNumber = {
|
|
99
|
-
index: number;
|
|
100
|
-
value: BigNumber;
|
|
101
|
-
};
|
|
102
|
-
export declare type TickInfoWithBigNumber = {
|
|
103
|
-
initialized: boolean;
|
|
104
|
-
liquidityGross: BigNumber;
|
|
105
|
-
liquidityNet: BigNumber;
|
|
106
|
-
secondsOutside: number;
|
|
107
|
-
secondsPerLiquidityOutsideX128: BigNumber;
|
|
108
|
-
tickCumulativeOutside: BigNumber;
|
|
109
|
-
};
|
|
110
|
-
export declare type TickInfoMappingsWithBigNumber = {
|
|
111
|
-
index: number;
|
|
112
|
-
value: TickInfoWithBigNumber;
|
|
113
|
-
};
|
|
114
|
-
export declare type DecodedStateMultiCallResultWithRelativeBitmaps = {
|
|
115
|
-
pool: Address;
|
|
116
|
-
blockTimestamp: BigNumber;
|
|
117
|
-
slot0: {
|
|
118
|
-
feeProtocol: number;
|
|
119
|
-
observationCardinality: number;
|
|
120
|
-
observationCardinalityNext: number;
|
|
121
|
-
observationIndex: number;
|
|
122
|
-
sqrtPriceX96: BigNumber;
|
|
123
|
-
tick: number;
|
|
124
|
-
unlocked: boolean;
|
|
125
|
-
};
|
|
126
|
-
liquidity: BigNumber;
|
|
127
|
-
tickSpacing: number;
|
|
128
|
-
maxLiquidityPerTick: BigNumber;
|
|
129
|
-
observation: {
|
|
130
|
-
blockTimestamp: number;
|
|
131
|
-
initialized: boolean;
|
|
132
|
-
secondsPerLiquidityCumulativeX128: BigNumber;
|
|
133
|
-
tickCumulative: BigNumber;
|
|
134
|
-
};
|
|
135
|
-
tickBitmap: TickBitMapMappingsWithBigNumber[];
|
|
136
|
-
ticks: TickInfoMappingsWithBigNumber[];
|
|
137
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UniswapV3Functions = void 0;
|
|
4
|
-
var UniswapV3Functions;
|
|
5
|
-
(function (UniswapV3Functions) {
|
|
6
|
-
UniswapV3Functions["exactInput"] = "exactInput";
|
|
7
|
-
UniswapV3Functions["exactOutput"] = "exactOutput";
|
|
8
|
-
})(UniswapV3Functions = exports.UniswapV3Functions || (exports.UniswapV3Functions = {}));
|
|
9
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/pancakeswap-v3/types.ts"],"names":[],"mappings":";;;AA4FA,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,iDAA2B,CAAA;AAC7B,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BytesLike } from 'ethers';
|
|
2
|
-
import { MultiResult } from '../../lib/multi-wrapper';
|
|
3
|
-
import { DexConfigMap } from '../../types';
|
|
4
|
-
import { DexParams, DecodedStateMultiCallResultWithRelativeBitmaps } from './types';
|
|
5
|
-
export declare function getUniswapV3DexKey(UniswapV3Config: DexConfigMap<DexParams>): string;
|
|
6
|
-
export declare function decodeStateMultiCallResultWithRelativeBitmaps(result: MultiResult<BytesLike> | BytesLike): DecodedStateMultiCallResultWithRelativeBitmaps;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeStateMultiCallResultWithRelativeBitmaps = exports.getUniswapV3DexKey = 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 getUniswapV3DexKey(UniswapV3Config) {
|
|
8
|
-
const UniswapV3Keys = Object.keys(UniswapV3Config);
|
|
9
|
-
if (UniswapV3Keys.length !== 1) {
|
|
10
|
-
throw new Error(`UniswapV3 key in UniswapV3Config is not unique. Update relevant places (optimizer) or fix config issue. Received: ${JSON.stringify(UniswapV3Config, (_0, value) => (typeof value === 'bigint' ? value.toString() : value))}`);
|
|
11
|
-
}
|
|
12
|
-
return UniswapV3Keys[0].toLowerCase();
|
|
13
|
-
}
|
|
14
|
-
exports.getUniswapV3DexKey = getUniswapV3DexKey;
|
|
15
|
-
function decodeStateMultiCallResultWithRelativeBitmaps(result) {
|
|
16
|
-
const [isSuccess, toDecode] = (0, decoders_1.extractSuccessAndValue)(result);
|
|
17
|
-
(0, ts_essentials_1.assert)(isSuccess && toDecode !== '0x', `decodeStateMultiCallResultWithRelativeBitmaps failed to get decodable result: ${result}`);
|
|
18
|
-
const decoded = ethers_1.ethers.utils.defaultAbiCoder.decode([
|
|
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
|
-
) observation,
|
|
42
|
-
tuple(
|
|
43
|
-
int16 index,
|
|
44
|
-
uint256 value,
|
|
45
|
-
)[] tickBitmap,
|
|
46
|
-
tuple(
|
|
47
|
-
int24 index,
|
|
48
|
-
tuple(
|
|
49
|
-
uint128 liquidityGross,
|
|
50
|
-
int128 liquidityNet,
|
|
51
|
-
int56 tickCumulativeOutside,
|
|
52
|
-
uint160 secondsPerLiquidityOutsideX128,
|
|
53
|
-
uint32 secondsOutside,
|
|
54
|
-
bool initialized,
|
|
55
|
-
) value,
|
|
56
|
-
)[] ticks
|
|
57
|
-
)
|
|
58
|
-
`,
|
|
59
|
-
], toDecode)[0];
|
|
60
|
-
// This conversion is not precise, because when we decode, we have more values
|
|
61
|
-
// But I typed only the ones that are used later
|
|
62
|
-
return decoded;
|
|
63
|
-
}
|
|
64
|
-
exports.decodeStateMultiCallResultWithRelativeBitmaps = decodeStateMultiCallResultWithRelativeBitmaps;
|
|
65
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/pancakeswap-v3/utils.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAC3C,iDAAuC;AACvC,iDAA4D;AAQ5D,SAAgB,kBAAkB,CAAC,eAAwC;IACzE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CACb,qHAAqH,IAAI,CAAC,SAAS,CACjI,eAAe,EACf,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CACtE,EAAE,CACJ,CAAC;KACH;IAED,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxC,CAAC;AAZD,gDAYC;AAED,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCD;KACA,EACD,QAAQ,CACT,CAAC,CAAC,CAAC,CAAC;IACL,8EAA8E;IAC9E,gDAAgD;IAChD,OAAO,OAAyD,CAAC;AACnE,CAAC;AA1DD,sGA0DC"}
|