UNPKG

moonwalkerswap-v1-core

Version:
944 lines 506 kB
{ "contractName": "Tick", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Tick\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Contains functions for managing tick processes and relevant calculations\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Tick.sol\":\"Tick\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/LiquidityMath.sol\":{\"keccak256\":\"0x2fcb84bece328675849d09dee9439901fd14c852efa2cb84a7dd1ada04a90a1e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce303eb639ca62f247a8a49a65f15b25b931fbd64b176c2180a6ea790f99bb11\",\"dweb:/ipfs/QmXehfxvPATibRJ2JWWBnLbDyA7hMk5jWCxidpJfDKGQVD\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/LowGasSafeMath.sol\":{\"keccak256\":\"0xf2583083971cf8a4274e14515aabbf9f4855193e34fe2addb0ca7b1589519b0c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cbf0ada2bba8827d459101a2359e4682be749b9ddd0a3c44f26119c9a0898e82\",\"dweb:/ipfs/QmPmKotXLza9j7sjNaXSYY9XbyZhkkQ3nMeWE9tiHKeouC\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol\":{\"keccak256\":\"0x4a12ab60fdb663b341bb3a2f5c6631ba40b7b6fa9d131c9540b60dbb4196a27e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d55e89b639f5ea027798cf3f246f38209308e812b8e568d19aa487bcdc8008a0\",\"dweb:/ipfs/QmfRWZGxKK21EgQea2PLxgJ6aypEbQjQSotHiruXGmKVm6\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Tick.sol\":{\"keccak256\":\"0xdabed554c4b1fea880edd6cf571840824de530ce51d6c9703cad19221590af5a\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://160fc25b4e616c2b51f50a49289c43f269f049d7834c48eafe3356048d9f7824\",\"dweb:/ipfs/QmNbtt4nCxonZ7qfzTuoain4Wo3KiSBmuczP6PexcFnKj6\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickMath.sol\":{\"keccak256\":\"0x1f864a2bf61ba05f3173eaf2e3f94c5e1da4bec0554757527b6d1ef1fe439e4e\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://5139b586df546a9d1c46804ca400b1cb9ce87236eaf212ebd64edee6747a172a\",\"dweb:/ipfs/QmVa2kcRw3VyuB6j1EVWXACKnkbQZgfXYXNi5voq3XkYG8\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220732dd8f5e256991b9e7152b1fac8e95d2b2d88b9f550b41efa7329302be2355564736f6c63430007060033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220732dd8f5e256991b9e7152b1fac8e95d2b2d88b9f550b41efa7329302be2355564736f6c63430007060033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "277:9423:28:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "277:9423:28:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './TickMath.sol';\nimport './LiquidityMath.sol';\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n mapping(int24 => Tick.Info) storage self,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n Info storage lower = self[tickLower];\n Info storage upper = self[tickUpper];\n\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal returns (bool flipped) {\n Tick.Info storage info = self[tick];\n\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, 'LO');\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Clears tick data\n /// @param self The mapping containing all initialized tick information for initialized ticks\n /// @param tick The tick that will be cleared\n function clear(mapping(int24 => Tick.Info) storage self, int24 tick) internal {\n delete self[tick];\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The destination tick of the transition\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param tickCumulative The tick * time elapsed since the pool was first initialized\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal returns (int128 liquidityNet) {\n Tick.Info storage info = self[tick];\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n", "sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Tick.sol", "ast": { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Tick.sol", "exportedSymbols": { "LiquidityMath": [ 4042 ], "LowGasSafeMath": [ 4172 ], "SafeCast": [ 5150 ], "Tick": [ 6379 ], "TickMath": [ 7170 ] }, "id": 6380, "license": "BUSL-1.1", "nodeType": "SourceUnit", "nodes": [ { "id": 5929, "literals": [ "solidity", ">=", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "37:24:28" }, { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/LowGasSafeMath.sol", "file": "./LowGasSafeMath.sol", "id": 5930, "nodeType": "ImportDirective", "scope": 6380, "sourceUnit": 4173, "src": "63:30:28", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/SafeCast.sol", "file": "./SafeCast.sol", "id": 5931, "nodeType": "ImportDirective", "scope": 6380, "sourceUnit": 5151, "src": "94:24:28", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickMath.sol", "file": "./TickMath.sol", "id": 5932, "nodeType": "ImportDirective", "scope": 6380, "sourceUnit": 7171, "src": "120:24:28", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/LiquidityMath.sol", "file": "./LiquidityMath.sol", "id": 5933, "nodeType": "ImportDirective", "scope": 6380, "sourceUnit": 4043, "src": "145:29:28", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 5934, "nodeType": "StructuredDocumentation", "src": "176:101:28", "text": "@title Tick\n @notice Contains functions for managing tick processes and relevant calculations" }, "fullyImplemented": true, "id": 6379, "linearizedBaseContracts": [ 6379 ], "name": "Tick", "nodeType": "ContractDefinition", "nodes": [ { "id": 5937, "libraryName": { "id": 5935, "name": "LowGasSafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4172, "src": "302:14:28", "typeDescriptions": { "typeIdentifier": "t_contract$_LowGasSafeMath_$4172", "typeString": "library LowGasSafeMath" } }, "nodeType": "UsingForDirective", "src": "296:32:28", "typeName": { "id": 5936, "name": "int256", "nodeType": "ElementaryTypeName", "src": "321:6:28", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } }, { "id": 5940, "libraryName": { "id": 5938, "name": "SafeCast", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5150, "src": "339:8:28", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeCast_$5150", "typeString": "library SafeCast" } }, "nodeType": "UsingForDirective", "src": "333:26:28", "typeName": { "id": 5939, "name": "int256", "nodeType": "ElementaryTypeName", "src": "352:6:28", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } } }, { "canonicalName": "Tick.Info", "id": 5957, "members": [ { "constant": false, "id": 5942, "mutability": "mutable", "name": "liquidityGross", "nodeType": "VariableDeclaration", "scope": 5957, "src": "509:22:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" }, "typeName": { "id": 5941, "name": "uint128", "nodeType": "ElementaryTypeName", "src": "509:7:28", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" } }, "visibility": "internal" }, { "constant": false, "id": 5944, "mutability": "mutable", "name": "liquidityNet", "nodeType": "VariableDeclaration", "scope": 5957, "src": "652:19:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int128", "typeString": "int128" }, "typeName": { "id": 5943, "name": "int128", "nodeType": "ElementaryTypeName", "src": "652:6:28", "typeDescriptions": { "typeIdentifier": "t_int128", "typeString": "int128" } }, "visibility": "internal" }, { "constant": false, "id": 5946, "mutability": "mutable", "name": "feeGrowthOutside0X128", "nodeType": "VariableDeclaration", "scope": 5957, "src": "894:29:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5945, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "894:7:28", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 5948, "mutability": "mutable", "name": "feeGrowthOutside1X128", "nodeType": "VariableDeclaration", "scope": 5957, "src": "933:29:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5947, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "933:7:28", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 5950, "mutability": "mutable", "name": "tickCumulativeOutside", "nodeType": "VariableDeclaration", "scope": 5957, "src": "1039:27:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int56", "typeString": "int56" }, "typeName": { "id": 5949, "name": "int56", "nodeType": "ElementaryTypeName", "src": "1039:5:28", "typeDescriptions": { "typeIdentifier": "t_int56", "typeString": "int56" } }, "visibility": "internal" }, { "constant": false, "id": 5952, "mutability": "mutable", "name": "secondsPerLiquidityOutsideX128", "nodeType": "VariableDeclaration", "scope": 5957, "src": "1290:38:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint160", "typeString": "uint160" }, "typeName": { "id": 5951, "name": "uint160", "nodeType": "ElementaryTypeName", "src": "1290:7:28", "typeDescriptions": { "typeIdentifier": "t_uint160", "typeString": "uint160" } }, "visibility": "internal" }, { "constant": false, "id": 5954, "mutability": "mutable", "name": "secondsOutside", "nodeType": "VariableDeclaration", "scope": 5957, "src": "1533:21:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 5953, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1533:6:28", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "visibility": "internal" }, { "constant": false, "id": 5956, "mutability": "mutable", "name": "initialized", "nodeType": "VariableDeclaration", "scope": 5957, "src": "1779:16:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 5955, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1779:4:28", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "name": "Info", "nodeType": "StructDefinition", "scope": 6379, "src": "421:1381:28", "visibility": "public" }, { "body": { "id": 6007, "nodeType": "Block", "src": "2288:271:28", "statements": [ { "assignments": [ 5966 ], "declarations": [ { "constant": false, "id": 5966, "mutability": "mutable", "name": "minTick", "nodeType": "VariableDeclaration", "scope": 6007, "src": "2298:13:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 5965, "name": "int24", "nodeType": "ElementaryTypeName", "src": "2298:5:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" } ], "id": 5974, "initialValue": { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5973, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "components": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5970, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 5967, "name": "TickMath", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7170, "src": "2315:8:28", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_TickMath_$7170_$", "typeString": "type(library TickMath)" } }, "id": 5968, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "MIN_TICK", "nodeType": "MemberAccess", "referencedDeclaration": 6643, "src": "2315:17:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "id": 5969, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5960, "src": "2335:11:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2315:31:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "id": 5971, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2314:33:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "id": 5972, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5960, "src": "2350:11:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2314:47:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "VariableDeclarationStatement", "src": "2298:63:28" }, { "assignments": [ 5976 ], "declarations": [ { "constant": false, "id": 5976, "mutability": "mutable", "name": "maxTick", "nodeType": "VariableDeclaration", "scope": 6007, "src": "2371:13:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 5975, "name": "int24", "nodeType": "ElementaryTypeName", "src": "2371:5:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" } ], "id": 5984, "initialValue": { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5983, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "components": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5980, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 5977, "name": "TickMath", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7170, "src": "2388:8:28", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_TickMath_$7170_$", "typeString": "type(library TickMath)" } }, "id": 5978, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "MAX_TICK", "nodeType": "MemberAccess", "referencedDeclaration": 6648, "src": "2388:17:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "id": 5979, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5960, "src": "2408:11:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2388:31:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "id": 5981, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2387:33:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "id": 5982, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5960, "src": "2423:11:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2387:47:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "VariableDeclarationStatement", "src": "2371:63:28" }, { "assignments": [ 5986 ], "declarations": [ { "constant": false, "id": 5986, "mutability": "mutable", "name": "numTicks", "nodeType": "VariableDeclaration", "scope": 6007, "src": "2444:15:28", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" }, "typeName": { "id": 5985, "name": "uint24", "nodeType": "ElementaryTypeName", "src": "2444:6:28", "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" } }, "visibility": "internal" } ], "id": 5998, "initialValue": { "commonType": { "typeIdentifier": "t_uint24", "typeString": "uint24" }, "id": 5997, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "arguments": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5994, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "components": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 5991, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 5989, "name": "maxTick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5976, "src": "2470:7:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "id": 5990, "name": "minTick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5966, "src": "2480:7:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2470:17:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "id": 5992, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "2469:19:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "id": 5993, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5960, "src": "2491:11:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2469:33:28", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int24", "typeString": "int24" } ], "id": 5988, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2462:6:28", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint24_$", "typeString": "type(uint24)" }, "typeName": { "id": 5987, "name": "uint24", "nodeType": "ElementaryTypeName", "src": "2462:6:28", "typeDescriptions": {} } }, "id": 5995, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2462:41:28", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "hexValue": "31", "id": 5996, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "2506:1:28", "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "2462:45:28", "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" } }, "nodeType": "VariableDeclarationStatement", "src": "2444:63:28" }, { "expression": { "commonType": { "typeIdentifier": "t_uint128", "typeString": "uint128" }, "id": 6005, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "arguments": [ { "id": 6001, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2529:7:28", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint128_$", "typeString": "type(uint128)" }, "typeName": { "id": 6000, "name": "uint128", "nodeType": "ElementaryTypeName", "src": "2529:7:28", "typeDescriptions": {} } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_type$_t_uint128_$", "typeString": "type(uint128)" } ], "id": 5999, "name": "type", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4294967269, "src": "2524:4:28", "typeDescriptions": { "typeIdentifier": "t_function_metatype_pure$__$returns$__$", "typeString": "function () pure" } }, "id": 6002, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2524:13:28", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_magic_meta_type_t_uint128", "typeString": "type(uint128)" } }, "id": 6003, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "max", "nodeType": "MemberAccess", "src": "2524:17:28", "typeDescriptio