moonwalkerswap-v1-core
Version:
Moonwalkerswap v1 core
1,033 lines (1,032 loc) • 204 kB
JSON
{
"contractName": "Position",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Positions store additional state for tracking fees owed to the position\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Position\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Positions represent an owner address' liquidity between a lower and upper tick boundary\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Position.sol\":\"Position\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FixedPoint128.sol\":{\"keccak256\":\"0x2d1f4f73ae0d8f0a210b8d30084659b57c56ac8f2f96011fca36f00a6d417178\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://2ba88933f16cd2df398e19c6ad227268f83c03081b70d243c97116d2ed9bc241\",\"dweb:/ipfs/QmTUGxdh8snzEM9VrTSS47StCg9VVWvvLJtJeNnMTFY4xb\"]},\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xe511530871deaef86692cea9adb6076d26d7b47fd4815ce51af52af981026057\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc5a6ae776be3e7dcbd23d49ffbc9d792fed0ddf4b111ebb64b9bb2133ec263e\",\"dweb:/ipfs/QmbAUtWqvipzEARQpFpkzYKBELy3qeW5WXnZxHFU84sxG7\"]},\"/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/Position.sol\":{\"keccak256\":\"0x7fb1a35fcc8b2104f1899d98cd1ce49b5e3af1bdad9da28a5bcda1d4081465e9\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://28f43918f6528913abe8586ea4607281b97cdce35f869ae86369487c6ee6eb6c\",\"dweb:/ipfs/QmTgTRMZ5FQT2MCkgUmuhGbt39uyoiVwgXWNJbzoZqiC4f\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e4facc33b5bc1067e6aaf0115beefac4a186beffa3d0877e757cce5f9b050ae564736f6c63430007060033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e4facc33b5bc1067e6aaf0115beefac4a186beffa3d0877e757cce5f9b050ae564736f6c63430007060033",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "350:3224:24:-:0;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "350:3224:24:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './FixedPoint128.sol';\nimport './LiquidityMath.sol';\n\n/// @title Position\n/// @notice Positions represent an owner address' liquidity between a lower and upper tick boundary\n/// @dev Positions store additional state for tracking fees owed to the position\nlibrary Position {\n // info stored for each user's position\n struct Info {\n // the amount of liquidity owned by this position\n uint128 liquidity;\n // fee growth per unit of liquidity as of the last update to liquidity or fees owed\n uint256 feeGrowthInside0LastX128;\n uint256 feeGrowthInside1LastX128;\n // the fees owed to the position owner in token0/token1\n uint128 tokensOwed0;\n uint128 tokensOwed1;\n }\n\n /// @notice Returns the Info struct of a position, given an owner and position boundaries\n /// @param self The mapping containing all user positions\n /// @param owner The address of the position owner\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @return position The position info struct of the given owners' position\n function get(\n mapping(bytes32 => Info) storage self,\n address owner,\n int24 tickLower,\n int24 tickUpper\n ) internal view returns (Position.Info storage position) {\n position = self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];\n }\n\n /// @notice Credits accumulated fees to a user's position\n /// @param self The individual position to update\n /// @param liquidityDelta The change in pool liquidity as a result of the position update\n /// @param feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @param feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function update(\n Info storage self,\n int128 liquidityDelta,\n uint256 feeGrowthInside0X128,\n uint256 feeGrowthInside1X128\n ) internal {\n Info memory _self = self;\n\n uint128 liquidityNext;\n if (liquidityDelta == 0) {\n require(_self.liquidity > 0, 'NP'); // disallow pokes for 0 liquidity positions\n liquidityNext = _self.liquidity;\n } else {\n liquidityNext = LiquidityMath.addDelta(_self.liquidity, liquidityDelta);\n }\n\n // calculate accumulated fees\n uint128 tokensOwed0 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside0X128 - _self.feeGrowthInside0LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n uint128 tokensOwed1 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside1X128 - _self.feeGrowthInside1LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n\n // update the position\n if (liquidityDelta != 0) self.liquidity = liquidityNext;\n self.feeGrowthInside0LastX128 = feeGrowthInside0X128;\n self.feeGrowthInside1LastX128 = feeGrowthInside1X128;\n if (tokensOwed0 > 0 || tokensOwed1 > 0) {\n // overflow is acceptable, have to withdraw before you hit type(uint128).max fees\n self.tokensOwed0 += tokensOwed0;\n self.tokensOwed1 += tokensOwed1;\n }\n }\n}\n",
"sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Position.sol",
"ast": {
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/Position.sol",
"exportedSymbols": {
"FixedPoint128": [
3807
],
"FullMath": [
3990
],
"LiquidityMath": [
4042
],
"Position": [
5080
]
},
"id": 5081,
"license": "BUSL-1.1",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 4909,
"literals": [
"solidity",
">=",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "37:24:24"
},
{
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol",
"file": "./FullMath.sol",
"id": 4910,
"nodeType": "ImportDirective",
"scope": 5081,
"sourceUnit": 3991,
"src": "63:24:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FixedPoint128.sol",
"file": "./FixedPoint128.sol",
"id": 4911,
"nodeType": "ImportDirective",
"scope": 5081,
"sourceUnit": 3808,
"src": "88:29:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/LiquidityMath.sol",
"file": "./LiquidityMath.sol",
"id": 4912,
"nodeType": "ImportDirective",
"scope": 5081,
"sourceUnit": 4043,
"src": "118:29:24",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 4913,
"nodeType": "StructuredDocumentation",
"src": "149:201:24",
"text": "@title Position\n @notice Positions represent an owner address' liquidity between a lower and upper tick boundary\n @dev Positions store additional state for tracking fees owed to the position"
},
"fullyImplemented": true,
"id": 5080,
"linearizedBaseContracts": [
5080
],
"name": "Position",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "Position.Info",
"id": 4924,
"members": [
{
"constant": false,
"id": 4915,
"mutability": "mutable",
"name": "liquidity",
"nodeType": "VariableDeclaration",
"scope": 4924,
"src": "497:17:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 4914,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "497:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4917,
"mutability": "mutable",
"name": "feeGrowthInside0LastX128",
"nodeType": "VariableDeclaration",
"scope": 4924,
"src": "616:32:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4916,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "616:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4919,
"mutability": "mutable",
"name": "feeGrowthInside1LastX128",
"nodeType": "VariableDeclaration",
"scope": 4924,
"src": "658:32:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4918,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "658:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4921,
"mutability": "mutable",
"name": "tokensOwed0",
"nodeType": "VariableDeclaration",
"scope": 4924,
"src": "764:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 4920,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "764:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4923,
"mutability": "mutable",
"name": "tokensOwed1",
"nodeType": "VariableDeclaration",
"scope": 4924,
"src": "793:19:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 4922,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "793:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"name": "Info",
"nodeType": "StructDefinition",
"scope": 5080,
"src": "417:402:24",
"visibility": "public"
},
{
"body": {
"id": 4953,
"nodeType": "Block",
"src": "1440:90:24",
"statements": [
{
"expression": {
"id": 4951,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 4940,
"name": "position",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4938,
"src": "1450:8:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info storage pointer"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"baseExpression": {
"id": 4941,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4929,
"src": "1461:4:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Info_$4924_storage_$",
"typeString": "mapping(bytes32 => struct Position.Info storage ref)"
}
},
"id": 4950,
"indexExpression": {
"arguments": [
{
"arguments": [
{
"id": 4945,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4931,
"src": "1493:5:24",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 4946,
"name": "tickLower",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4933,
"src": "1500:9:24",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
}
},
{
"id": 4947,
"name": "tickUpper",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4935,
"src": "1511:9:24",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_int24",
"typeString": "int24"
},
{
"typeIdentifier": "t_int24",
"typeString": "int24"
}
],
"expression": {
"id": 4943,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967295,
"src": "1476:3:24",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 4944,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodePacked",
"nodeType": "MemberAccess",
"src": "1476:16:24",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$",
"typeString": "function () pure returns (bytes memory)"
}
},
"id": 4948,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1476:45:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 4942,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967288,
"src": "1466:9:24",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 4949,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1466:56:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "1461:62:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage",
"typeString": "struct Position.Info storage ref"
}
},
"src": "1450:73:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info storage pointer"
}
},
"id": 4952,
"nodeType": "ExpressionStatement",
"src": "1450:73:24"
}
]
},
"documentation": {
"id": 4925,
"nodeType": "StructuredDocumentation",
"src": "825:416:24",
"text": "@notice Returns the Info struct of a position, given an owner and position boundaries\n @param self The mapping containing all user positions\n @param owner The address of the position owner\n @param tickLower The lower tick boundary of the position\n @param tickUpper The upper tick boundary of the position\n @return position The position info struct of the given owners' position"
},
"id": 4954,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "get",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 4936,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4929,
"mutability": "mutable",
"name": "self",
"nodeType": "VariableDeclaration",
"scope": 4954,
"src": "1268:37:24",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Info_$4924_storage_$",
"typeString": "mapping(bytes32 => struct Position.Info)"
},
"typeName": {
"id": 4928,
"keyType": {
"id": 4926,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1276:7:24",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "1268:24:24",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_Info_$4924_storage_$",
"typeString": "mapping(bytes32 => struct Position.Info)"
},
"valueType": {
"id": 4927,
"name": "Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4924,
"src": "1287:4:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info"
}
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4931,
"mutability": "mutable",
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 4954,
"src": "1315:13:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 4930,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1315:7:24",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4933,
"mutability": "mutable",
"name": "tickLower",
"nodeType": "VariableDeclaration",
"scope": 4954,
"src": "1338:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
},
"typeName": {
"id": 4932,
"name": "int24",
"nodeType": "ElementaryTypeName",
"src": "1338:5:24",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4935,
"mutability": "mutable",
"name": "tickUpper",
"nodeType": "VariableDeclaration",
"scope": 4954,
"src": "1363:15:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
},
"typeName": {
"id": 4934,
"name": "int24",
"nodeType": "ElementaryTypeName",
"src": "1363:5:24",
"typeDescriptions": {
"typeIdentifier": "t_int24",
"typeString": "int24"
}
},
"visibility": "internal"
}
],
"src": "1258:126:24"
},
"returnParameters": {
"id": 4939,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 4938,
"mutability": "mutable",
"name": "position",
"nodeType": "VariableDeclaration",
"scope": 4954,
"src": "1408:30:24",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info"
},
"typeName": {
"id": 4937,
"name": "Position.Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4924,
"src": "1408:13:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info"
}
},
"visibility": "internal"
}
],
"src": "1407:32:24"
},
"scope": 5080,
"src": "1246:284:24",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 5078,
"nodeType": "Block",
"src": "2175:1397:24",
"statements": [
{
"assignments": [
4967
],
"declarations": [
{
"constant": false,
"id": 4967,
"mutability": "mutable",
"name": "_self",
"nodeType": "VariableDeclaration",
"scope": 5078,
"src": "2185:17:24",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_memory_ptr",
"typeString": "struct Position.Info"
},
"typeName": {
"id": 4966,
"name": "Info",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4924,
"src": "2185:4:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info"
}
},
"visibility": "internal"
}
],
"id": 4969,
"initialValue": {
"id": 4968,
"name": "self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4957,
"src": "2205:4:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_storage_ptr",
"typeString": "struct Position.Info storage pointer"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2185:24:24"
},
{
"assignments": [
4971
],
"declarations": [
{
"constant": false,
"id": 4971,
"mutability": "mutable",
"name": "liquidityNext",
"nodeType": "VariableDeclaration",
"scope": 5078,
"src": "2220:21:24",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 4970,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "2220:7:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"id": 4972,
"nodeType": "VariableDeclarationStatement",
"src": "2220:21:24"
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_int128",
"typeString": "int128"
},
"id": 4975,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 4973,
"name": "liquidityDelta",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4959,
"src": "2255:14:24",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"hexValue": "30",
"id": 4974,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2273:1:24",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "2255:19:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 4999,
"nodeType": "Block",
"src": "2430:96:24",
"statements": [
{
"expression": {
"id": 4997,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 4990,
"name": "liquidityNext",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4971,
"src": "2444:13:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"expression": {
"id": 4993,
"name": "_self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4967,
"src": "2483:5:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_memory_ptr",
"typeString": "struct Position.Info memory"
}
},
"id": 4994,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "liquidity",
"nodeType": "MemberAccess",
"referencedDeclaration": 4915,
"src": "2483:15:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
{
"id": 4995,
"name": "liquidityDelta",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4959,
"src": "2500:14:24",
"typeDescriptions": {
"typeIdentifier": "t_int128",
"typeString": "int128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
{
"typeIdentifier": "t_int128",
"typeString": "int128"
}
],
"expression": {
"id": 4991,
"name": "LiquidityMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4042,
"src": "2460:13:24",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_LiquidityMath_$4042_$",
"typeString": "type(library LiquidityMath)"
}
},
"id": 4992,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "addDelta",
"nodeType": "MemberAccess",
"referencedDeclaration": 4041,
"src": "2460:22:24",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint128_$_t_int128_$returns$_t_uint128_$",
"typeString": "function (uint128,int128) pure returns (uint128)"
}
},
"id": 4996,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2460:55:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "2444:71:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"id": 4998,
"nodeType": "ExpressionStatement",
"src": "2444:71:24"
}
]
},
"id": 5000,
"nodeType": "IfStatement",
"src": "2251:275:24",
"trueBody": {
"id": 4989,
"nodeType": "Block",
"src": "2276:148:24",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"id": 4980,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"expression": {
"id": 4977,
"name": "_self",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4967,
"src": "2298:5:24",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Info_$4924_memory_ptr",
"typeString": "struct Position.Info memory"
}
},
"id": 4978,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "liquidity",
"nodeType": "MemberAccess",
"referencedDeclaration": 4915,
"src": "2298:15:24",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"hexValue": "30",
"id": 4979,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2316:1:24",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "2298:19:24",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "4e50",
"id": 4981,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2319:4:24",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebb814de87c671cfe97a338672e9700a9288a1a6d16839e238618b2b7f2aa86d",
"typeString": "literal_string \"NP\""
},
"value": "NP"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ebb814de87c671cfe97a338672e9700a9288a1a6d16839e238618b2b7f2aa86d",
"typeString": "literal_string \"NP\""
}
],
"id": 4976,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "2290:7:24",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 4982,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2290:34:24",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 4983,
"nodeType": "ExpressionStatement",
"src": "2290:34:24"
},
{
"expression": {
"id": 4987,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 4984,
"name": "liquidityNext",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4971,
"src": "2382:13:24",