@paraswap/dex-lib 2.23.1-zkevm-quickswap.4 → 2.23.2

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.
Files changed (62) hide show
  1. package/build/abi/algebra/AlgebraPool.abi.json +727 -0
  2. package/build/abi/algebra/AlgebraQuoter.abi.json +138 -0
  3. package/build/abi/algebra/AlgebraStateMulticall.abi.json +801 -0
  4. package/build/constants.d.ts +0 -1
  5. package/build/constants.js +0 -1
  6. package/build/constants.js.map +1 -1
  7. package/build/dex/algebra/algebra-pool.d.ts +41 -0
  8. package/build/dex/algebra/algebra-pool.js +267 -0
  9. package/build/dex/algebra/algebra-pool.js.map +1 -0
  10. package/build/dex/algebra/algebra.d.ts +53 -0
  11. package/build/dex/algebra/algebra.js +457 -0
  12. package/build/dex/algebra/algebra.js.map +1 -0
  13. package/build/dex/algebra/config.d.ts +4 -0
  14. package/build/dex/algebra/config.js +41 -0
  15. package/build/dex/algebra/config.js.map +1 -0
  16. package/build/dex/algebra/lib/AlgebraMath.d.ts +14 -0
  17. package/build/dex/algebra/lib/AlgebraMath.js +274 -0
  18. package/build/dex/algebra/lib/AlgebraMath.js.map +1 -0
  19. package/build/dex/algebra/lib/AlgebraXUniV3.d.ts +5 -0
  20. package/build/dex/algebra/lib/AlgebraXUniV3.js +45 -0
  21. package/build/dex/algebra/lib/AlgebraXUniV3.js.map +1 -0
  22. package/build/dex/algebra/lib/Constants.d.ts +5 -0
  23. package/build/dex/algebra/lib/Constants.js +10 -0
  24. package/build/dex/algebra/lib/Constants.js.map +1 -0
  25. package/build/dex/algebra/lib/DataStorage.d.ts +24 -0
  26. package/build/dex/algebra/lib/DataStorage.js +388 -0
  27. package/build/dex/algebra/lib/DataStorage.js.map +1 -0
  28. package/build/dex/algebra/lib/DataStorageOperator.d.ts +9 -0
  29. package/build/dex/algebra/lib/DataStorageOperator.js +66 -0
  30. package/build/dex/algebra/lib/DataStorageOperator.js.map +1 -0
  31. package/build/dex/algebra/lib/Sqrt.d.ts +3 -0
  32. package/build/dex/algebra/lib/Sqrt.js +60 -0
  33. package/build/dex/algebra/lib/Sqrt.js.map +1 -0
  34. package/build/dex/algebra/lib/TickManager.d.ts +10 -0
  35. package/build/dex/algebra/lib/TickManager.js +3 -0
  36. package/build/dex/algebra/lib/TickManager.js.map +1 -0
  37. package/build/dex/algebra/types.d.ts +55 -0
  38. package/build/dex/algebra/types.js +3 -0
  39. package/build/dex/algebra/types.js.map +1 -0
  40. package/build/dex/camelot/camelot.d.ts +7 -6
  41. package/build/dex/camelot/camelot.js +4 -2
  42. package/build/dex/camelot/camelot.js.map +1 -1
  43. package/build/dex/camelot/config.js +1 -2
  44. package/build/dex/camelot/config.js.map +1 -1
  45. package/build/dex/camelot/types.d.ts +1 -2
  46. package/build/dex/quickswap/config.js +0 -6
  47. package/build/dex/quickswap/config.js.map +1 -1
  48. package/build/dex/uniswap-v3/config.js +0 -17
  49. package/build/dex/uniswap-v3/config.js.map +1 -1
  50. package/build/dex/uniswap-v3/uniswap-v3.js +2 -2
  51. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  52. package/build/dex/weth/config.js +0 -3
  53. package/build/dex/weth/config.js.map +1 -1
  54. package/package.json +1 -1
  55. package/src/constants.ts +0 -1
  56. package/src/dex/camelot/camelot.ts +11 -22
  57. package/src/dex/camelot/config.ts +1 -2
  58. package/src/dex/camelot/types.ts +1 -7
  59. package/src/dex/quickswap/config.ts +0 -7
  60. package/src/dex/uniswap-v3/config.ts +0 -18
  61. package/src/dex/uniswap-v3/uniswap-v3.ts +2 -4
  62. package/src/dex/weth/config.ts +0 -3
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataStorage = void 0;
4
+ const ts_essentials_1 = require("ts-essentials");
5
+ const utils_1 = require("../../../utils");
6
+ require("./FullMath.sol");
7
+ const WINDOW = 24n * 60n;
8
+ const UINT16_MODULO = 65536n;
9
+ class DataStorage {
10
+ /// @notice Calculates volatility between two sequential timepoints with resampling to 1 sec frequency
11
+ /// @param dt Timedelta between timepoints, must be within uint32 range
12
+ /// @param tick0 The tick at the left timepoint, must be within int24 range
13
+ /// @param tick1 The tick at the right timepoint, must be within int24 range
14
+ /// @param avgTick0 The average tick at the left timepoint, must be within int24 range
15
+ /// @param avgTick1 The average tick at the right timepoint, must be within int24 range
16
+ /// @return volatility The volatility between two sequential timepoints
17
+ /// If the requirements for the parameters are met, it always fits 88 bits
18
+ static _volatilityOnRange(dt, tick0, tick1, avgTick0, avgTick1) {
19
+ // On the time interval from the previous timepoint to the current
20
+ // we can represent tick and average tick change as two straight lines:
21
+ // tick = k*t + b, where k and b are some constants
22
+ // avgTick = p*t + q, where p and q are some constants
23
+ // we want to get sum of (tick(t) - avgTick(t))^2 for every t in the interval (0; dt]
24
+ // so: (tick(t) - avgTick(t))^2 = ((k*t + b) - (p*t + q))^2 = (k-p)^2 * t^2 + 2(k-p)(b-q)t + (b-q)^2
25
+ // since everything except t is a constant, we need to use progressions for t and t^2:
26
+ // sum(t) for t from 1 to dt = dt*(dt + 1)/2 = sumOfSequence
27
+ // sum(t^2) for t from 1 to dt = dt*(dt+1)*(2dt + 1)/6 = sumOfSquares
28
+ // so result will be: (k-p)^2 * sumOfSquares + 2(k-p)(b-q)*sumOfSequence + dt*(b-q)^2
29
+ const K = tick1 - tick0 - (avgTick1 - avgTick0); // (k - p)*dt
30
+ const B = (tick0 - avgTick0) * dt; // (b - q)*dt
31
+ const sumOfSquares = dt * (dt + 1n) * (2n * dt + 1n); // sumOfSquares * 6
32
+ const sumOfSequence = dt * (dt + 1n); // sumOfSequence * 2
33
+ const volatility = (0, utils_1.uint256)((K ** 2n * sumOfSquares +
34
+ 6n * B * K * sumOfSequence +
35
+ 6n * dt * B ** 2n) /
36
+ (6n * dt ** 2n));
37
+ return volatility;
38
+ }
39
+ /// @notice Transforms a previous timepoint into a new timepoint, given the passage of time and the current tick and liquidity values
40
+ /// @dev blockTimestamp _must_ be chronologically equal to or greater than last.blockTimestamp, safe for 0 or 1 overflows
41
+ /// @param last The specified timepoint to be used in creation of new timepoint
42
+ /// @param blockTimestamp The timestamp of the new timepoint
43
+ /// @param tick The active tick at the time of the new timepoint
44
+ /// @param prevTick The active tick at the time of the last timepoint
45
+ /// @param liquidity The total in-range liquidity at the time of the new timepoint
46
+ /// @param averageTick The average tick at the time of the new timepoint
47
+ /// @param volumePerLiquidity The gmean(volumes)/liquidity at the time of the new timepoint
48
+ /// @return Timepoint The newly populated timepoint
49
+ static createNewTimepoint(last, blockTimestamp, tick, prevTick, liquidity, averageTick, volumePerLiquidity) {
50
+ const delta = blockTimestamp - last.blockTimestamp;
51
+ last.initialized = true;
52
+ last.blockTimestamp = blockTimestamp;
53
+ last.tickCumulative += (0, utils_1.int56)(tick) * delta;
54
+ last.secondsPerLiquidityCumulative +=
55
+ ((0, utils_1.uint160)(delta) << 128n) / (liquidity > 0n ? liquidity : 1n); // just timedelta if liquidity == 0
56
+ last.volatilityCumulative += (0, utils_1.uint88)(this._volatilityOnRange(delta, prevTick, tick, last.averageTick, averageTick)); // always fits 88 bits
57
+ last.averageTick = averageTick;
58
+ last.volumePerLiquidityCumulative += volumePerLiquidity;
59
+ return last;
60
+ }
61
+ /// @notice comparator for 32-bit timestamps
62
+ /// @dev safe for 0 or 1 overflows, a and b _must_ be chronologically before or equal to currentTime
63
+ /// @param a A comparison timestamp from which to determine the relative position of `currentTime`
64
+ /// @param b From which to determine the relative position of `currentTime`
65
+ /// @param currentTime A timestamp truncated to 32 bits
66
+ /// @return res Whether `a` is chronologically <= `b`
67
+ static lteConsideringOverflow(a, b, currentTime) {
68
+ let res = a > currentTime;
69
+ if (res == b > currentTime)
70
+ res = a <= b; // if both are on the same side
71
+ return res;
72
+ }
73
+ /// @dev guaranteed that the result is within the bounds of int24
74
+ /// returns int256 for fuzzy tests
75
+ static _getAverageTick(self, time, tick, index, oldestIndex, lastTimestamp, lastTickCumulative) {
76
+ const oldestTimestamp = self[Number(oldestIndex)].blockTimestamp;
77
+ const oldestTickCumulative = self[Number(oldestIndex)].tickCumulative;
78
+ let avgTick;
79
+ if (this.lteConsideringOverflow(oldestTimestamp, time - WINDOW, time)) {
80
+ if (this.lteConsideringOverflow(lastTimestamp, time - WINDOW, time)) {
81
+ index -= 1n; // considering underflow
82
+ const startTimepoint = self[Number(index)];
83
+ avgTick = startTimepoint.initialized
84
+ ? (lastTickCumulative - startTimepoint.tickCumulative) /
85
+ (lastTimestamp - startTimepoint.blockTimestamp)
86
+ : tick;
87
+ }
88
+ else {
89
+ const startOfWindow = this.getSingleTimepoint(self, time, WINDOW, tick, index, oldestIndex, 0n);
90
+ // current-WINDOW last current
91
+ // _________*____________*_______*_
92
+ // ||||||||||||
93
+ avgTick =
94
+ (lastTickCumulative - startOfWindow.tickCumulative) /
95
+ (lastTimestamp - time + WINDOW);
96
+ }
97
+ }
98
+ else {
99
+ avgTick =
100
+ lastTimestamp == oldestTimestamp
101
+ ? tick
102
+ : (lastTickCumulative - oldestTickCumulative) /
103
+ (lastTimestamp - oldestTimestamp);
104
+ }
105
+ return avgTick;
106
+ }
107
+ /// @notice Fetches the timepoints beforeOrAt and atOrAfter a target, i.e. where [beforeOrAt, atOrAfter] is satisfied.
108
+ /// The result may be the same timepoint, or adjacent timepoints.
109
+ /// @dev The answer must be contained in the array, used when the target is located within the stored timepoint
110
+ /// boundaries: older than the most recent timepoint and younger, or the same age as, the oldest timepoint
111
+ /// @param self The stored dataStorage array
112
+ /// @param time The current block.timestamp
113
+ /// @param target The timestamp at which the reserved timepoint should be for
114
+ /// @param lastIndex The index of the timepoint that was most recently written to the timepoints array
115
+ /// @param oldestIndex The index of the oldest timepoint in the timepoints array
116
+ /// @return beforeOrAt The timepoint recorded before, or at, the target
117
+ /// @return atOrAfter The timepoint recorded at, or after, the target
118
+ static binarySearch(self, time, target, lastIndex, oldestIndex) {
119
+ let left = oldestIndex; // oldest timepoint
120
+ let right = lastIndex >= oldestIndex ? lastIndex : lastIndex + UINT16_MODULO; // newest timepoint considering one index overflow
121
+ let current = (left + right) >> 1n; // "middle" point between the boundaries
122
+ let beforeOrAt;
123
+ let atOrAfter;
124
+ let initializedAfter;
125
+ let timestampAfter;
126
+ do {
127
+ beforeOrAt = self[Number((0, utils_1.uint16)(current))]; // checking the "middle" point between the boundaries
128
+ let [initializedBefore, timestampBefore] = [
129
+ beforeOrAt.initialized,
130
+ beforeOrAt.blockTimestamp,
131
+ ];
132
+ if (initializedBefore) {
133
+ if (this.lteConsideringOverflow(timestampBefore, target, time)) {
134
+ // is current point before or at `target`?
135
+ atOrAfter = self[Number((0, utils_1.uint16)(current + 1n))]; // checking the next point after "middle"
136
+ [initializedAfter, timestampAfter] = [
137
+ atOrAfter.initialized,
138
+ atOrAfter.blockTimestamp,
139
+ ];
140
+ if (initializedAfter) {
141
+ if (this.lteConsideringOverflow(target, timestampAfter, time)) {
142
+ // is the "next" point after or at `target`?
143
+ return [beforeOrAt, atOrAfter]; // the only fully correct way to finish
144
+ }
145
+ left = current + 1n; // "next" point is before the `target`, so looking in the right half
146
+ }
147
+ else {
148
+ // beforeOrAt is initialized and <= target, and next timepoint is uninitialized
149
+ // should be impossible if initial boundaries and `target` are correct
150
+ return [beforeOrAt, beforeOrAt];
151
+ }
152
+ }
153
+ else {
154
+ right = current - 1n; // current point is after the `target`, so looking in the left half
155
+ }
156
+ }
157
+ else {
158
+ // we've landed on an uninitialized timepoint, keep searching higher
159
+ // should be impossible if initial boundaries and `target` are correct
160
+ left = current + 1n;
161
+ }
162
+ current = (left + right) >> 1n; // calculating the new "middle" point index after updating the bounds
163
+ } while (true); // protect with max nb of iterations?
164
+ // unreachable code here
165
+ // atOrAfter = beforeOrAt; // code is unreachable, to suppress compiler warning
166
+ // assert(false);
167
+ // return [beforeOrAt, atOrAfter]
168
+ }
169
+ /// @dev Reverts if an timepoint at or before the desired timepoint timestamp does not exist.
170
+ /// 0 may be passed as `secondsAgo' to return the current cumulative values.
171
+ /// If called with a timestamp falling between two timepoints, returns the counterfactual accumulator values
172
+ /// at exactly the timestamp between the two timepoints.
173
+ /// @param self The stored dataStorage array
174
+ /// @param time The current block timestamp
175
+ /// @param secondsAgo The amount of time to look back, in seconds, at which point to return an timepoint
176
+ /// @param tick The current tick
177
+ /// @param index The index of the timepoint that was most recently written to the timepoints array
178
+ /// @param oldestIndex The index of the oldest timepoint
179
+ /// @param liquidity The current in-range pool liquidity
180
+ /// @return targetTimepoint desired timepoint or it's approximation
181
+ static getSingleTimepoint(self, time, secondsAgo, tick, index, oldestIndex, liquidity) {
182
+ let target = time - secondsAgo;
183
+ // if target is newer than last timepoint
184
+ if (secondsAgo == 0n ||
185
+ this.lteConsideringOverflow(self[Number(index)].blockTimestamp, target, time)) {
186
+ let last = self[Number(index)];
187
+ if (last.blockTimestamp == target) {
188
+ return last;
189
+ }
190
+ else {
191
+ // otherwise, we need to add new timepoint
192
+ let avgTick = (0, utils_1.int24)(this._getAverageTick(self, time, tick, index, oldestIndex, last.blockTimestamp, last.tickCumulative));
193
+ let prevTick = tick;
194
+ {
195
+ if (index != oldestIndex) {
196
+ // FIXME?
197
+ let prevLast = {
198
+ averageTick: 0n,
199
+ blockTimestamp: 0n,
200
+ initialized: false,
201
+ secondsPerLiquidityCumulative: 0n,
202
+ tickCumulative: 0n,
203
+ volatilityCumulative: 0n,
204
+ volumePerLiquidityCumulative: 0n,
205
+ };
206
+ let _prevLast = self[Number(index - 1n)]; // considering index underflow
207
+ prevLast.blockTimestamp = _prevLast.blockTimestamp;
208
+ prevLast.tickCumulative = _prevLast.tickCumulative;
209
+ prevTick = (0, utils_1.int24)((last.tickCumulative - prevLast.tickCumulative) /
210
+ (last.blockTimestamp - prevLast.blockTimestamp));
211
+ }
212
+ }
213
+ return this.createNewTimepoint(last, target, tick, prevTick, liquidity, avgTick, 0n);
214
+ }
215
+ }
216
+ (0, utils_1._require)(this.lteConsideringOverflow(self[Number(oldestIndex)].blockTimestamp, target, time), 'OLD');
217
+ let [beforeOrAt, atOrAfter] = this.binarySearch(self, time, target, index, oldestIndex);
218
+ if (target == atOrAfter.blockTimestamp) {
219
+ return atOrAfter; // we're at the right boundary
220
+ }
221
+ if (target != beforeOrAt.blockTimestamp) {
222
+ // we're in the middle
223
+ let timepointTimeDelta = atOrAfter.blockTimestamp - beforeOrAt.blockTimestamp;
224
+ let targetDelta = target - beforeOrAt.blockTimestamp;
225
+ // For gas savings the resulting point is written to beforeAt
226
+ beforeOrAt.tickCumulative +=
227
+ ((atOrAfter.tickCumulative - beforeOrAt.tickCumulative) /
228
+ timepointTimeDelta) *
229
+ targetDelta;
230
+ beforeOrAt.secondsPerLiquidityCumulative += (0, utils_1.uint160)(((0, utils_1.uint256)(atOrAfter.secondsPerLiquidityCumulative -
231
+ beforeOrAt.secondsPerLiquidityCumulative) *
232
+ targetDelta) /
233
+ timepointTimeDelta);
234
+ beforeOrAt.volatilityCumulative +=
235
+ ((atOrAfter.volatilityCumulative - beforeOrAt.volatilityCumulative) /
236
+ timepointTimeDelta) *
237
+ targetDelta;
238
+ beforeOrAt.volumePerLiquidityCumulative +=
239
+ ((atOrAfter.volumePerLiquidityCumulative -
240
+ beforeOrAt.volumePerLiquidityCumulative) /
241
+ timepointTimeDelta) *
242
+ targetDelta;
243
+ }
244
+ // we're at the left boundary or at the middle
245
+ return beforeOrAt;
246
+ }
247
+ /// @notice Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`
248
+ /// @dev Reverts if `secondsAgos` > oldest timepoint
249
+ /// @param self The stored dataStorage array
250
+ /// @param time The current block.timestamp
251
+ /// @param secondsAgos Each amount of time to look back, in seconds, at which point to return an timepoint
252
+ /// @param tick The current tick
253
+ /// @param index The index of the timepoint that was most recently written to the timepoints array
254
+ /// @param liquidity The current in-range pool liquidity
255
+ /// @return tickCumulatives The tick * time elapsed since the pool was first initialized, as of each `secondsAgo`
256
+ /// @return secondsPerLiquidityCumulatives The cumulative seconds / max(1, liquidity) since the pool was first initialized, as of each `secondsAgo`
257
+ /// @return volatilityCumulatives The cumulative volatility values since the pool was first initialized, as of each `secondsAgo`
258
+ /// @return volumePerAvgLiquiditys The cumulative volume per liquidity values since the pool was first initialized, as of each `secondsAgo`
259
+ static getTimepoints(self, time, secondsAgos, tick, index, liquidity) {
260
+ let tickCumulatives = new Array(secondsAgos.length);
261
+ let secondsPerLiquidityCumulatives = new Array(secondsAgos.length);
262
+ let volatilityCumulatives = new Array(secondsAgos.length);
263
+ let volumePerAvgLiquiditys = new Array(secondsAgos.length);
264
+ let oldestIndex;
265
+ // check if we have overflow in the past
266
+ let nextIndex = index + 1n; // considering overflow
267
+ if (self[Number(nextIndex)].initialized) {
268
+ oldestIndex = nextIndex;
269
+ }
270
+ (0, ts_essentials_1.assert)(oldestIndex); // FIXME ?
271
+ let current;
272
+ for (let i = 0; i < secondsAgos.length; i++) {
273
+ current = this.getSingleTimepoint(self, time, secondsAgos[i], tick, index, oldestIndex, liquidity);
274
+ [
275
+ tickCumulatives[i],
276
+ secondsPerLiquidityCumulatives[i],
277
+ volatilityCumulatives[i],
278
+ volumePerAvgLiquiditys[i],
279
+ ] = [
280
+ current.tickCumulative,
281
+ current.secondsPerLiquidityCumulative,
282
+ current.volatilityCumulative,
283
+ current.volumePerLiquidityCumulative,
284
+ ];
285
+ }
286
+ return [
287
+ tickCumulatives,
288
+ secondsPerLiquidityCumulatives,
289
+ volatilityCumulatives,
290
+ volumePerAvgLiquiditys,
291
+ ];
292
+ }
293
+ /// @notice Returns average volatility in the range from time-WINDOW to time
294
+ /// @param self The stored dataStorage array
295
+ /// @param time The current block.timestamp
296
+ /// @param tick The current tick
297
+ /// @param index The index of the timepoint that was most recently written to the timepoints array
298
+ /// @param liquidity The current in-range pool liquidity
299
+ /// @return volatilityAverage The average volatility in the recent range
300
+ /// @return volumePerLiqAverage The average volume per liquidity in the recent range
301
+ static getAverages(self, time, tick, index, liquidity) {
302
+ let oldestIndex;
303
+ let oldest = self[0];
304
+ let nextIndex = index + 1n; // considering overflow
305
+ if (self[Number(nextIndex)].initialized) {
306
+ oldest = self[Number(nextIndex)];
307
+ oldestIndex = nextIndex;
308
+ }
309
+ (0, ts_essentials_1.assert)(oldestIndex); // FIXME ?
310
+ let endOfWindow = this.getSingleTimepoint(self, time, 0n, tick, index, oldestIndex, liquidity);
311
+ let oldestTimestamp = oldest.blockTimestamp;
312
+ if (this.lteConsideringOverflow(oldestTimestamp, time - WINDOW, time)) {
313
+ let startOfWindow = this.getSingleTimepoint(self, time, WINDOW, tick, index, oldestIndex, liquidity);
314
+ return [
315
+ (endOfWindow.volatilityCumulative -
316
+ startOfWindow.volatilityCumulative) /
317
+ WINDOW,
318
+ (0, utils_1.uint256)(endOfWindow.volumePerLiquidityCumulative -
319
+ startOfWindow.volumePerLiquidityCumulative) >> 57n,
320
+ ];
321
+ }
322
+ else if (time != oldestTimestamp) {
323
+ let _oldestVolatilityCumulative = oldest.volatilityCumulative;
324
+ let _oldestVolumePerLiquidityCumulative = oldest.volumePerLiquidityCumulative;
325
+ return [
326
+ (endOfWindow.volatilityCumulative - _oldestVolatilityCumulative) /
327
+ (time - oldestTimestamp),
328
+ (0, utils_1.uint256)(endOfWindow.volumePerLiquidityCumulative -
329
+ _oldestVolumePerLiquidityCumulative) >> 57n,
330
+ ];
331
+ }
332
+ return [0n, 0n]; // should not enter here ?
333
+ }
334
+ /// @notice Initialize the dataStorage array by writing the first slot. Called once for the lifecycle of the timepoints array
335
+ /// @param self The stored dataStorage array
336
+ /// @param time The time of the dataStorage initialization, via block.timestamp truncated to uint32
337
+ /// @param tick Initial tick
338
+ // static initialize(
339
+ // Timepoint[UINT16_MODULO] storage self,
340
+ // uint32 time,
341
+ // int24 tick
342
+ // ) internal {
343
+ // require(!self[0].initialized);
344
+ // self[0].initialized = true;
345
+ // self[0].blockTimestamp = time;
346
+ // self[0].averageTick = tick;
347
+ // }
348
+ /// @notice Writes an dataStorage timepoint to the array
349
+ /// @dev Writable at most once per block. Index represents the most recently written element. index must be tracked externally.
350
+ /// @param self The stored dataStorage array
351
+ /// @param index The index of the timepoint that was most recently written to the timepoints array
352
+ /// @param blockTimestamp The timestamp of the new timepoint
353
+ /// @param tick The active tick at the time of the new timepoint
354
+ /// @param liquidity The total in-range liquidity at the time of the new timepoint
355
+ /// @param volumePerLiquidity The gmean(volumes)/liquidity at the time of the new timepoint
356
+ /// @return indexUpdated The new index of the most recently written element in the dataStorage array
357
+ static write(self, index, blockTimestamp, tick, liquidity, volumePerLiquidity) {
358
+ let _last = self[Number(index)];
359
+ // early return if we've already written an timepoint this block
360
+ if (_last.blockTimestamp == blockTimestamp) {
361
+ return index;
362
+ }
363
+ let last = _last;
364
+ // get next index considering overflow
365
+ let indexUpdated = index + 1n;
366
+ let oldestIndex;
367
+ // check if we have overflow in the past
368
+ if (self[Number(indexUpdated)].initialized) {
369
+ oldestIndex = indexUpdated;
370
+ }
371
+ (0, ts_essentials_1.assert)(oldestIndex); // FIXME ?
372
+ let avgTick = (0, utils_1.int24)(this._getAverageTick(self, blockTimestamp, tick, index, oldestIndex, last.blockTimestamp, last.tickCumulative));
373
+ let prevTick = tick;
374
+ if (index != oldestIndex) {
375
+ let _prevLast = self[Number(index - 1n)]; // considering index underflow
376
+ let _prevLastBlockTimestamp = _prevLast.blockTimestamp;
377
+ let _prevLastTickCumulative = _prevLast.tickCumulative;
378
+ prevTick = (0, utils_1.int24)((last.tickCumulative - _prevLastTickCumulative) /
379
+ (last.blockTimestamp - _prevLastBlockTimestamp));
380
+ }
381
+ self[Number(indexUpdated)] = this.createNewTimepoint(last, blockTimestamp, tick, prevTick, liquidity, avgTick, volumePerLiquidity);
382
+ return indexUpdated;
383
+ }
384
+ }
385
+ exports.DataStorage = DataStorage;
386
+ DataStorage.WINDOW = WINDOW;
387
+ DataStorage.UINT16_MODULO = UINT16_MODULO;
388
+ //# sourceMappingURL=DataStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataStorage.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/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,kCAskBC;AArkBQ,kBAAM,GAAG,MAAM,CAAC;AAChB,yBAAa,GAAG,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { PoolState } from '../types';
2
+ export declare class DataStorageOperator {
3
+ static getSingleTimepoint(state: PoolState, time: bigint, secondsAgo: bigint, tick: bigint, index: bigint, liquidity: bigint): [bigint, bigint, bigint, bigint];
4
+ static getTimepoints(state: PoolState, time: bigint, secondsAgos: bigint[], tick: bigint, index: bigint, liquidity: bigint): [bigint[], bigint[], bigint[], bigint[]];
5
+ static getAverages(state: PoolState, time: bigint, tick: bigint, index: bigint, liquidity: bigint): [bigint, bigint];
6
+ static write(state: PoolState, index: bigint, blockTimestamp: bigint, tick: bigint, liquidity: bigint, volumePerLiquidity: bigint): bigint;
7
+ static calculateVolumePerLiquidity(liquidity: bigint, amount0: bigint, amount1: bigint): bigint;
8
+ static window(): bigint;
9
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataStorageOperator = void 0;
4
+ const ts_essentials_1 = require("ts-essentials");
5
+ const DataStorage_1 = require("./DataStorage");
6
+ const bigint_constants_1 = require("../../../bigint-constants");
7
+ const utils_1 = require("../../../utils");
8
+ const Sqrt_1 = require("./Sqrt");
9
+ // TO COMPARE WITH https://github.com/cryptoalgebra/Algebra/blob/3cd9a65bb5bb39d26fb4346e8f7d6d2a28672cc6/src/core/contracts/DataStorageOperator.sol#L16-L17
10
+ const MAX_VOLUME_PER_LIQUIDITY = 100000 << 64; // maximum meaningful ratio of volume to liquidity
11
+ class DataStorageOperator {
12
+ /// @inheritdoc IDataStorageOperator
13
+ static getSingleTimepoint(state, time, secondsAgo, tick, index, liquidity) {
14
+ let oldestIndex;
15
+ // check if we have overflow in the past
16
+ let nextIndex = index + 1n; // considering overflow
17
+ if (state.timepoints[Number(nextIndex)].initialized) {
18
+ oldestIndex = nextIndex;
19
+ }
20
+ (0, ts_essentials_1.assert)(oldestIndex); //
21
+ let result = DataStorage_1.DataStorage.getSingleTimepoint(state.timepoints, time, secondsAgo, tick, index, oldestIndex, liquidity);
22
+ let [tickCumulative, secondsPerLiquidityCumulative, volatilityCumulative, volumePerAvgLiquidity,] = [
23
+ result.tickCumulative,
24
+ result.secondsPerLiquidityCumulative,
25
+ result.volatilityCumulative,
26
+ result.volumePerLiquidityCumulative,
27
+ ];
28
+ return [
29
+ tickCumulative,
30
+ secondsPerLiquidityCumulative,
31
+ volatilityCumulative,
32
+ volumePerAvgLiquidity,
33
+ ];
34
+ }
35
+ /// @inheritdoc IDataStorageOperator
36
+ static getTimepoints(state, time, secondsAgos, tick, index, liquidity) {
37
+ return DataStorage_1.DataStorage.getTimepoints(state.timepoints, time, secondsAgos, tick, index, liquidity);
38
+ }
39
+ /// @inheritdoc IDataStorageOperator
40
+ static getAverages(state, time, tick, index, liquidity) {
41
+ return DataStorage_1.DataStorage.getAverages(state.timepoints, time, tick, index, liquidity);
42
+ }
43
+ /// @inheritdoc IDataStorageOperator
44
+ static write(state, index, blockTimestamp, tick, liquidity, volumePerLiquidity) {
45
+ return DataStorage_1.DataStorage.write(state.timepoints, index, blockTimestamp, tick, liquidity, volumePerLiquidity);
46
+ }
47
+ /// @inheritdoc IDataStorageOperator
48
+ static calculateVolumePerLiquidity(liquidity, amount0, amount1) {
49
+ let volume = Sqrt_1.Sqrt.sqrtAbs(amount0) * Sqrt_1.Sqrt.sqrtAbs(amount1);
50
+ let volumeShifted;
51
+ if (volume >= 2n ** 192n)
52
+ volumeShifted = bigint_constants_1.BI_MAX_UINT256 / (liquidity > 0n ? liquidity : 1n);
53
+ else
54
+ volumeShifted = (volume << 64n) / (liquidity > 0n ? liquidity : 1n);
55
+ if (volumeShifted >= MAX_VOLUME_PER_LIQUIDITY)
56
+ return BigInt(MAX_VOLUME_PER_LIQUIDITY);
57
+ else
58
+ return (0, utils_1.uint128)(volumeShifted);
59
+ }
60
+ /// @inheritdoc IDataStorageOperator
61
+ static window() {
62
+ return DataStorage_1.DataStorage.WINDOW;
63
+ }
64
+ }
65
+ exports.DataStorageOperator = DataStorageOperator;
66
+ //# sourceMappingURL=DataStorageOperator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataStorageOperator.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/DataStorageOperator.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,+CAA4C;AAC5C,gEAA2D;AAC3D,0CAAyC;AACzC,iCAA8B;AAE9B,4JAA4J;AAE5J,MAAM,wBAAwB,GAAG,MAAM,IAAI,EAAE,CAAC,CAAC,kDAAkD;AAEjG,MAAa,mBAAmB;IAC9B,oCAAoC;IACpC,MAAM,CAAC,kBAAkB,CACvB,KAAgB,EAChB,IAAY,EACZ,UAAkB,EAClB,IAAY,EACZ,KAAa,EACb,SAAiB;QAEjB,IAAI,WAAW,CAAC;QAChB,wCAAwC;QACxC,IAAI,SAAS,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,uBAAuB;QACnD,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE;YACnD,WAAW,GAAG,SAAS,CAAC;SACzB;QAED,IAAA,sBAAM,EAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QAEvB,IAAI,MAAM,GAAG,yBAAW,CAAC,kBAAkB,CACzC,KAAK,CAAC,UAAU,EAChB,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,CACV,CAAC;QACF,IAAI,CACF,cAAc,EACd,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACtB,GAAG;YACF,MAAM,CAAC,cAAc;YACrB,MAAM,CAAC,6BAA6B;YACpC,MAAM,CAAC,oBAAoB;YAC3B,MAAM,CAAC,4BAA4B;SACpC,CAAC;QAEF,OAAO;YACL,cAAc;YACd,6BAA6B;YAC7B,oBAAoB;YACpB,qBAAqB;SACtB,CAAC;IACJ,CAAC;IAED,oCAA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IAAI,aAAa,IAAI,wBAAwB;YAC3C,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;;YACrC,OAAO,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED,oCAAoC;IACpC,MAAM,CAAC,MAAM;QACX,OAAO,yBAAW,CAAC,MAAM,CAAC;IAC5B,CAAC;CAaF;AAvID,kDAuIC"}
@@ -0,0 +1,3 @@
1
+ export declare class Sqrt {
2
+ static sqrtAbs(_x: bigint): bigint;
3
+ }
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TickManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TickManager.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/TickManager.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { Address, NumberAsString } from '../../types';
2
+ import { TickInfo } from '../uniswap-v3/types';
3
+ declare type Timepoint = {
4
+ initialized: boolean;
5
+ blockTimestamp: bigint;
6
+ tickCumulative: bigint;
7
+ secondsPerLiquidityCumulative: bigint;
8
+ volatilityCumulative: bigint;
9
+ averageTick: bigint;
10
+ volumePerLiquidityCumulative: bigint;
11
+ };
12
+ declare type GlobalState = {
13
+ price: bigint;
14
+ tick: bigint;
15
+ fee: bigint;
16
+ timepointIndex: bigint;
17
+ communityFeeToken0: bigint;
18
+ communityFeeToken1: bigint;
19
+ unlocked: boolean;
20
+ };
21
+ export declare type PoolState = {
22
+ pool: string;
23
+ blockTimestamp: bigint;
24
+ tickSpacing: bigint;
25
+ globalState: GlobalState;
26
+ liquidity: bigint;
27
+ maxLiquidityPerTick: bigint;
28
+ tickBitmap: Record<NumberAsString, bigint>;
29
+ ticks: Record<NumberAsString, TickInfo>;
30
+ timepoints: Record<number, Timepoint>;
31
+ volumePerLiquidityInBlock: bigint;
32
+ isValid: boolean;
33
+ startTickBitmap: bigint;
34
+ balance0: bigint;
35
+ balance1: bigint;
36
+ };
37
+ export declare type AlgebraData = {
38
+ path: {
39
+ tokenIn: Address;
40
+ tokenOut: Address;
41
+ }[];
42
+ isApproved?: boolean;
43
+ };
44
+ export declare type DexParams = {
45
+ router: Address;
46
+ quoter: Address;
47
+ factory: Address;
48
+ algebraStateMulticall: Address;
49
+ uniswapMulticall: Address;
50
+ chunksCount: number;
51
+ deployer: Address;
52
+ subgraphURL: string;
53
+ initHash: string;
54
+ };
55
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map