UNPKG

moonwalkerswap-v1-core

Version:
1,101 lines 354 kB
{ "contractName": "TickBitmap", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Packed tick initialized state library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Stores a packed mapping of tick index to its initialized state\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickBitmap.sol\":\"TickBitmap\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/BitMath.sol\":{\"keccak256\":\"0xfdb9011d56f4fc6dbf7dfa9bd191d13c405dc1ef5f295e222d402fedd7b78b4a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://635d12ff3353f4996357c4c8798051c49755de9a9431c8068fdd45364c8359f4\",\"dweb:/ipfs/QmfTTffPWDnN1aBeNXgcdozJeBxa9Q6CWJJ2bZh7ZoymKz\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickBitmap.sol\":{\"keccak256\":\"0x2035bacd76333baa4ef2bbd6423561638e1b7e97cb19be5b4d61feeea3340364\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://55da2e8d44c094b9aa1a40577f9ff32605516ae45ad54e799ec9d570d007a206\",\"dweb:/ipfs/QmakgjThKgfBTaj6Vvf54oKkxeHqgxKFmyiVbcjstsGDBF\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220037dc8e13d6aadbc3f77637a8789cf0563a4b497e5ccdac14fbc6632e8462bd864736f6c63430007060033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220037dc8e13d6aadbc3f77637a8789cf0563a4b497e5ccdac14fbc6632e8462bd864736f6c63430007060033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "331:3780:29:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "331:3780:29:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './BitMath.sol';\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(tick % 256);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param self The mapping in which to flip the tick\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing\n ) internal {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (int16 wordPos, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n self[wordPos] ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param self The mapping in which to compute the next initialized tick\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal view returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (int16 wordPos, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing\n : (compressed - int24(bitPos)) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (int16 wordPos, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(BitMath.leastSignificantBit(masked) - bitPos)) * tickSpacing\n : (compressed + 1 + int24(type(uint8).max - bitPos)) * tickSpacing;\n }\n }\n}\n", "sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickBitmap.sol", "ast": { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/TickBitmap.sol", "exportedSymbols": { "BitMath": [ 3800 ], "TickBitmap": [ 6635 ] }, "id": 6636, "license": "BUSL-1.1", "nodeType": "SourceUnit", "nodes": [ { "id": 6381, "literals": [ "solidity", ">=", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "37:24:29" }, { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/BitMath.sol", "file": "./BitMath.sol", "id": 6382, "nodeType": "ImportDirective", "scope": 6636, "sourceUnit": 3801, "src": "63:23:29", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 6383, "nodeType": "StructuredDocumentation", "src": "88:243:29", "text": "@title Packed tick initialized state library\n @notice Stores a packed mapping of tick index to its initialized state\n @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word." }, "fullyImplemented": true, "id": 6635, "linearizedBaseContracts": [ 6635 ], "name": "TickBitmap", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 6411, "nodeType": "Block", "src": "767:79:29", "statements": [ { "expression": { "id": 6400, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 6393, "name": "wordPos", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6389, "src": "777:7:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "arguments": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6398, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6396, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6386, "src": "793:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": ">>", "rightExpression": { "hexValue": "38", "id": 6397, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "801:1:29", "typeDescriptions": { "typeIdentifier": "t_rational_8_by_1", "typeString": "int_const 8" }, "value": "8" }, "src": "793:9:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int24", "typeString": "int24" } ], "id": 6395, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "787:5:29", "typeDescriptions": { "typeIdentifier": "t_type$_t_int16_$", "typeString": "type(int16)" }, "typeName": { "id": 6394, "name": "int16", "nodeType": "ElementaryTypeName", "src": "787:5:29", "typeDescriptions": {} } }, "id": 6399, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "787:16:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "src": "777:26:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "id": 6401, "nodeType": "ExpressionStatement", "src": "777:26:29" }, { "expression": { "id": 6409, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 6402, "name": "bitPos", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6391, "src": "813:6:29", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "arguments": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6407, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6405, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6386, "src": "828:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "hexValue": "323536", "id": 6406, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "835:3:29", "typeDescriptions": { "typeIdentifier": "t_rational_256_by_1", "typeString": "int_const 256" }, "value": "256" }, "src": "828:10:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int24", "typeString": "int24" } ], "id": 6404, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "822:5:29", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint8_$", "typeString": "type(uint8)" }, "typeName": { "id": 6403, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "822:5:29", "typeDescriptions": {} } }, "id": 6408, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "822:17:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "813:26:29", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "id": 6410, "nodeType": "ExpressionStatement", "src": "813:26:29" } ] }, "documentation": { "id": 6384, "nodeType": "StructuredDocumentation", "src": "356:325:29", "text": "@notice Computes the position in the mapping where the initialized bit for a tick lives\n @param tick The tick for which to compute the position\n @return wordPos The key in the mapping containing the word in which the bit is stored\n @return bitPos The bit position in the word where the flag is stored" }, "id": 6412, "implemented": true, "kind": "function", "modifiers": [], "name": "position", "nodeType": "FunctionDefinition", "parameters": { "id": 6387, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 6386, "mutability": "mutable", "name": "tick", "nodeType": "VariableDeclaration", "scope": 6412, "src": "704:10:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 6385, "name": "int24", "nodeType": "ElementaryTypeName", "src": "704:5:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" } ], "src": "703:12:29" }, "returnParameters": { "id": 6392, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 6389, "mutability": "mutable", "name": "wordPos", "nodeType": "VariableDeclaration", "scope": 6412, "src": "738:13:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" }, "typeName": { "id": 6388, "name": "int16", "nodeType": "ElementaryTypeName", "src": "738:5:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "visibility": "internal" }, { "constant": false, "id": 6391, "mutability": "mutable", "name": "bitPos", "nodeType": "VariableDeclaration", "scope": 6412, "src": "753:12:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 6390, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "753:5:29", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "visibility": "internal" } ], "src": "737:29:29" }, "scope": 6635, "src": "686:160:29", "stateMutability": "pure", "virtual": false, "visibility": "private" }, { "body": { "id": 6454, "nodeType": "Block", "src": "1230:220:29", "statements": [ { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6429, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6427, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6425, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6419, "src": "1248:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "id": 6426, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6421, "src": "1255:11:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "1248:18:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "hexValue": "30", "id": 6428, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1270:1:29", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1248:23:29", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 6424, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "1240:7:29", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 6430, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1240:32:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 6431, "nodeType": "ExpressionStatement", "src": "1240:32:29" }, { "assignments": [ 6433, 6435 ], "declarations": [ { "constant": false, "id": 6433, "mutability": "mutable", "name": "wordPos", "nodeType": "VariableDeclaration", "scope": 6454, "src": "1317:13:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" }, "typeName": { "id": 6432, "name": "int16", "nodeType": "ElementaryTypeName", "src": "1317:5:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "visibility": "internal" }, { "constant": false, "id": 6435, "mutability": "mutable", "name": "bitPos", "nodeType": "VariableDeclaration", "scope": 6454, "src": "1332:12:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 6434, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "1332:5:29", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "visibility": "internal" } ], "id": 6441, "initialValue": { "arguments": [ { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6439, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6437, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6419, "src": "1357:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "id": 6438, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6421, "src": "1364:11:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "1357:18:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_int24", "typeString": "int24" } ], "id": 6436, "name": "position", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6412, "src": "1348:8:29", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_int24_$returns$_t_int16_$_t_uint8_$", "typeString": "function (int24) pure returns (int16,uint8)" } }, "id": 6440, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1348:28:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_int16_$_t_uint8_$", "typeString": "tuple(int16,uint8)" } }, "nodeType": "VariableDeclarationStatement", "src": "1316:60:29" }, { "assignments": [ 6443 ], "declarations": [ { "constant": false, "id": 6443, "mutability": "mutable", "name": "mask", "nodeType": "VariableDeclaration", "scope": 6454, "src": "1386:12:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 6442, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1386:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 6447, "initialValue": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 6446, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "hexValue": "31", "id": 6444, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1401:1:29", "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "nodeType": "BinaryOperation", "operator": "<<", "rightExpression": { "id": 6445, "name": "bitPos", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6435, "src": "1406:6:29", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "1401:11:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1386:26:29" }, { "expression": { "id": 6452, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "baseExpression": { "id": 6448, "name": "self", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6417, "src": "1422:4:29", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_int16_$_t_uint256_$", "typeString": "mapping(int16 => uint256)" } }, "id": 6450, "indexExpression": { "id": 6449, "name": "wordPos", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6433, "src": "1427:7:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1422:13:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "^=", "rightHandSide": { "id": 6451, "name": "mask", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6443, "src": "1439:4:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1422:21:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 6453, "nodeType": "ExpressionStatement", "src": "1422:21:29" } ] }, "documentation": { "id": 6413, "nodeType": "StructuredDocumentation", "src": "852:245:29", "text": "@notice Flips the initialized state for a given tick from false to true, or vice versa\n @param self The mapping in which to flip the tick\n @param tick The tick to flip\n @param tickSpacing The spacing between usable ticks" }, "id": 6455, "implemented": true, "kind": "function", "modifiers": [], "name": "flipTick", "nodeType": "FunctionDefinition", "parameters": { "id": 6422, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 6417, "mutability": "mutable", "name": "self", "nodeType": "VariableDeclaration", "scope": 6455, "src": "1129:38:29", "stateVariable": false, "storageLocation": "storage", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_int16_$_t_uint256_$", "typeString": "mapping(int16 => uint256)" }, "typeName": { "id": 6416, "keyType": { "id": 6414, "name": "int16", "nodeType": "ElementaryTypeName", "src": "1137:5:29", "typeDescriptions": { "typeIdentifier": "t_int16", "typeString": "int16" } }, "nodeType": "Mapping", "src": "1129:25:29", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_int16_$_t_uint256_$", "typeString": "mapping(int16 => uint256)" }, "valueType": { "id": 6415, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1146:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "visibility": "internal" }, { "constant": false, "id": 6419, "mutability": "mutable", "name": "tick", "nodeType": "VariableDeclaration", "scope": 6455, "src": "1177:10:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 6418, "name": "int24", "nodeType": "ElementaryTypeName", "src": "1177:5:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" }, { "constant": false, "id": 6421, "mutability": "mutable", "name": "tickSpacing", "nodeType": "VariableDeclaration", "scope": 6455, "src": "1197:17:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 6420, "name": "int24", "nodeType": "ElementaryTypeName", "src": "1197:5:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" } ], "src": "1119:101:29" }, "returnParameters": { "id": 6423, "nodeType": "ParameterList", "parameters": [], "src": "1230:0:29" }, "scope": 6635, "src": "1102:348:29", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 6633, "nodeType": "Block", "src": "2402:1707:29", "statements": [ { "assignments": [ 6474 ], "declarations": [ { "constant": false, "id": 6474, "mutability": "mutable", "name": "compressed", "nodeType": "VariableDeclaration", "scope": 6633, "src": "2412:16:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" }, "typeName": { "id": 6473, "name": "int24", "nodeType": "ElementaryTypeName", "src": "2412:5:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "visibility": "internal" } ], "id": 6478, "initialValue": { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6477, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6475, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6462, "src": "2431:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "id": 6476, "name": "tickSpacing", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6464, "src": "2438:11:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "src": "2431:18:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "VariableDeclarationStatement", "src": "2412:37:29" }, { "condition": { "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 6487, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_int24", "typeString": "int24" }, "id": 6481, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 6479, "name": "tick", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6462, "src": "2463:4:29", "typeDescriptions": { "typeIdentifier": "t_int24", "typeString": "int24" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "hexValue": "30", "id": 6480, "isConstant": false, "isLValue": false, "isPure": true, "