Files
contract/deployment/alpha/out/LiquidityAmounts.sol/LiquidityAmounts.json
2023-11-16 17:36:43 -04:00

4501 lines
193 KiB
JSON

{
"abi": [],
"bytecode": {
"object": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122067e4a312c25029eaaabf8e643ab6554cf3931f1380f949fcd531456541c7844664736f6c63430008160033",
"sourceMap": "327:6487:45:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;327:6487:45;;;;;;;;;;;;;;;;;",
"linkReferences": {}
},
"deployedBytecode": {
"object": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122067e4a312c25029eaaabf8e643ab6554cf3931f1380f949fcd531456541c7844664736f6c63430008160033",
"sourceMap": "327:6487:45:-:0;;;;;;;;",
"linkReferences": {}
},
"methodIdentifiers": {},
"rawMetadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Liquidity amount functions\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Provides functions for computing liquidity amounts from token amounts and prices\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"lib_uniswap/v3-periphery/contracts/libraries/LiquidityAmounts.sol\":\"LiquidityAmounts\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"details\":{\"constantOptimizer\":true,\"cse\":true,\"deduplicate\":true,\"inliner\":true,\"jumpdestRemover\":true,\"orderLiterals\":true,\"peephole\":true,\"simpleCounterForLoopUncheckedIncrement\":true,\"yul\":true,\"yulDetails\":{\"optimizerSteps\":\"dhfoD[xarrscLMcCTU]uljmul:fDnTOcmu\",\"stackAllocation\":true}},\"runs\":999999999},\"remappings\":[\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":@uniswap/v3-core/=lib_uniswap/v3-core/\",\":@uniswap/v3-periphery/=lib_uniswap/v3-periphery/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":v3-core/=lib_uniswap/v3-core/\",\":v3-periphery/libraries/=lib_uniswap/v3-periphery/contracts/libraries/\"]},\"sources\":{\"lib_uniswap/v3-core/contracts/libraries/FixedPoint96.sol\":{\"keccak256\":\"0x0ba8a9b95a956a4050749c0158e928398c447c91469682ca8a7cc7e77a7fe032\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://186d3b528866065a5856f96d2aeec698efa99f8da913e9adf34f8cc296cc993d\",\"dweb:/ipfs/QmUAiMvtAQp8c9dy57bqJYzG7hkb1uChiPaQmt264skoqP\"]},\"lib_uniswap/v3-core/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0x77608bce1ddeb28ed9963b554b55e8a083277eda7be31e2c7255ef532cc408be\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8fcb307cf783b612ab9abd339296391d202974e7aa158deff23d9fb3aaac832d\",\"dweb:/ipfs/QmXhcwQajcGZADQtVoQpSWYNY4tB3Y42GPPyiaW62M5JH2\"]},\"lib_uniswap/v3-periphery/contracts/libraries/LiquidityAmounts.sol\":{\"keccak256\":\"0xf149581d28e1c81736dfe72be73ee1301d4945340cc6282fcdd63fe3c85abf24\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://0b67f375180bb62fe6753601cd09740496dcdcec4c0a4f9eaa6e94c5e1bb6844\",\"dweb:/ipfs/QmWYwkmqynRq7g81Nijg4eEkPgSRGnegDrbbEKkkTC1k2w\"]}},\"version\":1}",
"metadata": {
"compiler": {
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
"abi": [],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@uniswap/v3-core/=lib_uniswap/v3-core/",
"@uniswap/v3-periphery/=lib_uniswap/v3-periphery/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"v3-core/=lib_uniswap/v3-core/",
"v3-periphery/libraries/=lib_uniswap/v3-periphery/contracts/libraries/"
],
"optimizer": {
"runs": 999999999,
"details": {
"peephole": true,
"inliner": true,
"jumpdestRemover": true,
"orderLiterals": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true,
"yul": true,
"yulDetails": {
"stackAllocation": true,
"optimizerSteps": "dhfoD[xarrscLMcCTU]uljmul:fDnTOcmu"
}
}
},
"metadata": {
"bytecodeHash": "ipfs"
},
"compilationTarget": {
"lib_uniswap/v3-periphery/contracts/libraries/LiquidityAmounts.sol": "LiquidityAmounts"
},
"libraries": {}
},
"sources": {
"lib_uniswap/v3-core/contracts/libraries/FixedPoint96.sol": {
"keccak256": "0x0ba8a9b95a956a4050749c0158e928398c447c91469682ca8a7cc7e77a7fe032",
"urls": [
"bzz-raw://186d3b528866065a5856f96d2aeec698efa99f8da913e9adf34f8cc296cc993d",
"dweb:/ipfs/QmUAiMvtAQp8c9dy57bqJYzG7hkb1uChiPaQmt264skoqP"
],
"license": "GPL-2.0-or-later"
},
"lib_uniswap/v3-core/contracts/libraries/FullMath.sol": {
"keccak256": "0x77608bce1ddeb28ed9963b554b55e8a083277eda7be31e2c7255ef532cc408be",
"urls": [
"bzz-raw://8fcb307cf783b612ab9abd339296391d202974e7aa158deff23d9fb3aaac832d",
"dweb:/ipfs/QmXhcwQajcGZADQtVoQpSWYNY4tB3Y42GPPyiaW62M5JH2"
],
"license": "MIT"
},
"lib_uniswap/v3-periphery/contracts/libraries/LiquidityAmounts.sol": {
"keccak256": "0xf149581d28e1c81736dfe72be73ee1301d4945340cc6282fcdd63fe3c85abf24",
"urls": [
"bzz-raw://0b67f375180bb62fe6753601cd09740496dcdcec4c0a4f9eaa6e94c5e1bb6844",
"dweb:/ipfs/QmWYwkmqynRq7g81Nijg4eEkPgSRGnegDrbbEKkkTC1k2w"
],
"license": "GPL-2.0-or-later"
}
},
"version": 1
},
"ast": {
"absolutePath": "lib_uniswap/v3-periphery/contracts/libraries/LiquidityAmounts.sol",
"id": 45795,
"exportedSymbols": {
"FixedPoint96": [
44338
],
"FullMath": [
44519
],
"LiquidityAmounts": [
45794
]
},
"nodeType": "SourceUnit",
"src": "45:6770:45",
"nodes": [
{
"id": 45456,
"nodeType": "PragmaDirective",
"src": "45:24:45",
"nodes": [],
"literals": [
"solidity",
">=",
"0.5",
".0"
]
},
{
"id": 45457,
"nodeType": "ImportDirective",
"src": "71:59:45",
"nodes": [],
"absolutePath": "lib_uniswap/v3-core/contracts/libraries/FullMath.sol",
"file": "@uniswap/v3-core/contracts/libraries/FullMath.sol",
"nameLocation": "-1:-1:-1",
"scope": 45795,
"sourceUnit": 44520,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 45458,
"nodeType": "ImportDirective",
"src": "131:63:45",
"nodes": [],
"absolutePath": "lib_uniswap/v3-core/contracts/libraries/FixedPoint96.sol",
"file": "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol",
"nameLocation": "-1:-1:-1",
"scope": 45795,
"sourceUnit": 44339,
"symbolAliases": [],
"unitAlias": ""
},
{
"id": 45794,
"nodeType": "ContractDefinition",
"src": "327:6487:45",
"nodes": [
{
"id": 45480,
"nodeType": "FunctionDefinition",
"src": "507:110:45",
"nodes": [],
"body": {
"id": 45479,
"nodeType": "Block",
"src": "570:47:45",
"nodes": [],
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 45476,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"components": [
{
"id": 45473,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45468,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45465,
"src": "589:1:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45471,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45462,
"src": "601:1:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45470,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "593:7:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint128_$",
"typeString": "type(uint128)"
},
"typeName": {
"id": 45469,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "593:7:45",
"typeDescriptions": {}
}
},
"id": 45472,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "593:10:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "589:14:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"id": 45474,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "588:16:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 45475,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45462,
"src": "608:1:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "588:21:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 45467,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "580:7:45",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 45477,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "580:30:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45478,
"nodeType": "ExpressionStatement",
"src": "580:30:45"
}
]
},
"documentation": {
"id": 45460,
"nodeType": "StructuredDocumentation",
"src": "358:144:45",
"text": "@notice Downcasts uint256 to uint128\n @param x The uint258 to be downcasted\n @return y The passed value, downcasted to uint128"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "toUint128",
"nameLocation": "516:9:45",
"parameters": {
"id": 45463,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45462,
"mutability": "mutable",
"name": "x",
"nameLocation": "534:1:45",
"nodeType": "VariableDeclaration",
"scope": 45480,
"src": "526:9:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45461,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "526:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "525:11:45"
},
"returnParameters": {
"id": 45466,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45465,
"mutability": "mutable",
"name": "y",
"nameLocation": "567:1:45",
"nodeType": "VariableDeclaration",
"scope": 45480,
"src": "559:9:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45464,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "559:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "558:11:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "private"
},
{
"id": 45526,
"nodeType": "FunctionDefinition",
"src": "1085:475:45",
"nodes": [],
"body": {
"id": 45525,
"nodeType": "Block",
"src": "1252:308:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45494,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45492,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45483,
"src": "1266:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45493,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45485,
"src": "1282:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "1266:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45503,
"nodeType": "IfStatement",
"src": "1262:98:45",
"trueBody": {
"expression": {
"id": 45501,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45495,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45483,
"src": "1298:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45496,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45485,
"src": "1313:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45497,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "1297:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45498,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45485,
"src": "1331:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45499,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45483,
"src": "1346:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45500,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1330:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "1297:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45502,
"nodeType": "ExpressionStatement",
"src": "1297:63:45"
}
},
{
"assignments": [
45505
],
"declarations": [
{
"constant": false,
"id": 45505,
"mutability": "mutable",
"name": "intermediate",
"nameLocation": "1378:12:45",
"nodeType": "VariableDeclaration",
"scope": 45525,
"src": "1370:20:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45504,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1370:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"id": 45513,
"initialValue": {
"arguments": [
{
"id": 45508,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45483,
"src": "1409:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45509,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45485,
"src": "1424:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"expression": {
"id": 45510,
"name": "FixedPoint96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44338,
"src": "1439:12:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FixedPoint96_$44338_$",
"typeString": "type(library FixedPoint96)"
}
},
"id": 45511,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "1452:3:45",
"memberName": "Q96",
"nodeType": "MemberAccess",
"referencedDeclaration": 44337,
"src": "1439:16:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"id": 45506,
"name": "FullMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44519,
"src": "1393:8:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FullMath_$44519_$",
"typeString": "type(library FullMath)"
}
},
"id": 45507,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1402:6:45",
"memberName": "mulDiv",
"nodeType": "MemberAccess",
"referencedDeclaration": 44474,
"src": "1393:15:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 45512,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1393:63:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1370:86:45"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"id": 45517,
"name": "amount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45487,
"src": "1499:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"id": 45518,
"name": "intermediate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45505,
"src": "1508:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45521,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45519,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45485,
"src": "1522:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 45520,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45483,
"src": "1538:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "1522:29:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
],
"expression": {
"id": 45515,
"name": "FullMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44519,
"src": "1483:8:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FullMath_$44519_$",
"typeString": "type(library FullMath)"
}
},
"id": 45516,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1492:6:45",
"memberName": "mulDiv",
"nodeType": "MemberAccess",
"referencedDeclaration": 44474,
"src": "1483:15:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 45522,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1483:69:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45514,
"name": "toUint128",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45480,
"src": "1473:9:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint256) pure returns (uint128)"
}
},
"id": 45523,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1473:80:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"functionReturnParameters": 45491,
"id": 45524,
"nodeType": "Return",
"src": "1466:87:45"
}
]
},
"documentation": {
"id": 45481,
"nodeType": "StructuredDocumentation",
"src": "623:457:45",
"text": "@notice Computes the amount of liquidity received for a given amount of token0 and price range\n @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower))\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param amount0 The amount0 being sent in\n @return liquidity The amount of returned liquidity"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getLiquidityForAmount0",
"nameLocation": "1094:22:45",
"parameters": {
"id": 45488,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45483,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "1134:13:45",
"nodeType": "VariableDeclaration",
"scope": 45526,
"src": "1126:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45482,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "1126:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45485,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "1165:13:45",
"nodeType": "VariableDeclaration",
"scope": 45526,
"src": "1157:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45484,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "1157:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45487,
"mutability": "mutable",
"name": "amount0",
"nameLocation": "1196:7:45",
"nodeType": "VariableDeclaration",
"scope": 45526,
"src": "1188:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45486,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1188:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1116:93:45"
},
"returnParameters": {
"id": 45491,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45490,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "1241:9:45",
"nodeType": "VariableDeclaration",
"scope": 45526,
"src": "1233:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45489,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "1233:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "1232:19:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"id": 45563,
"nodeType": "FunctionDefinition",
"src": "1999:383:45",
"nodes": [],
"body": {
"id": 45562,
"nodeType": "Block",
"src": "2166:216:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45540,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45538,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45529,
"src": "2180:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45539,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45531,
"src": "2196:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "2180:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45549,
"nodeType": "IfStatement",
"src": "2176:98:45",
"trueBody": {
"expression": {
"id": 45547,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45541,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45529,
"src": "2212:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45542,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45531,
"src": "2227:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45543,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "2211:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45544,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45531,
"src": "2245:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45545,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45529,
"src": "2260:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45546,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "2244:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "2211:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45548,
"nodeType": "ExpressionStatement",
"src": "2211:63:45"
}
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"id": 45553,
"name": "amount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45533,
"src": "2317:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"expression": {
"id": 45554,
"name": "FixedPoint96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44338,
"src": "2326:12:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FixedPoint96_$44338_$",
"typeString": "type(library FixedPoint96)"
}
},
"id": 45555,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "2339:3:45",
"memberName": "Q96",
"nodeType": "MemberAccess",
"referencedDeclaration": 44337,
"src": "2326:16:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45556,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45531,
"src": "2344:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 45557,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45529,
"src": "2360:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "2344:29:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
],
"expression": {
"id": 45551,
"name": "FullMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44519,
"src": "2301:8:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FullMath_$44519_$",
"typeString": "type(library FullMath)"
}
},
"id": 45552,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "2310:6:45",
"memberName": "mulDiv",
"nodeType": "MemberAccess",
"referencedDeclaration": 44474,
"src": "2301:15:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 45559,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2301:73:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45550,
"name": "toUint128",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45480,
"src": "2291:9:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint256) pure returns (uint128)"
}
},
"id": 45560,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2291:84:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"functionReturnParameters": 45537,
"id": 45561,
"nodeType": "Return",
"src": "2284:91:45"
}
]
},
"documentation": {
"id": 45527,
"nodeType": "StructuredDocumentation",
"src": "1566:428:45",
"text": "@notice Computes the amount of liquidity received for a given amount of token1 and price range\n @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param amount1 The amount1 being sent in\n @return liquidity The amount of returned liquidity"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getLiquidityForAmount1",
"nameLocation": "2008:22:45",
"parameters": {
"id": 45534,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45529,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "2048:13:45",
"nodeType": "VariableDeclaration",
"scope": 45563,
"src": "2040:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45528,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "2040:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45531,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "2079:13:45",
"nodeType": "VariableDeclaration",
"scope": 45563,
"src": "2071:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45530,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "2071:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45533,
"mutability": "mutable",
"name": "amount1",
"nameLocation": "2110:7:45",
"nodeType": "VariableDeclaration",
"scope": 45563,
"src": "2102:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45532,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2102:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "2030:93:45"
},
"returnParameters": {
"id": 45537,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45536,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "2155:9:45",
"nodeType": "VariableDeclaration",
"scope": 45563,
"src": "2147:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45535,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "2147:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "2146:19:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"id": 45644,
"nodeType": "FunctionDefinition",
"src": "2982:901:45",
"nodes": [],
"body": {
"id": 45643,
"nodeType": "Block",
"src": "3204:679:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45581,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45579,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3218:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45580,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3234:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "3218:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45590,
"nodeType": "IfStatement",
"src": "3214:98:45",
"trueBody": {
"expression": {
"id": 45588,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45582,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3250:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45583,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3265:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45584,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "3249:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45585,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3283:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45586,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3298:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45587,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "3282:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "3249:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45589,
"nodeType": "ExpressionStatement",
"src": "3249:63:45"
}
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45593,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45591,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45566,
"src": "3327:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "<=",
"rightExpression": {
"id": 45592,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3343:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "3327:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45605,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45603,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45566,
"src": "3466:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"id": 45604,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3481:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "3466:28:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 45640,
"nodeType": "Block",
"src": "3779:98:45",
"statements": [
{
"expression": {
"id": 45638,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45632,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45577,
"src": "3793:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45634,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3828:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45635,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3843:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45636,
"name": "amount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45574,
"src": "3858:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45633,
"name": "getLiquidityForAmount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45563,
"src": "3805:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint160,uint160,uint256) pure returns (uint128)"
}
},
"id": 45637,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "3805:61:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "3793:73:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"id": 45639,
"nodeType": "ExpressionStatement",
"src": "3793:73:45"
}
]
},
"id": 45641,
"nodeType": "IfStatement",
"src": "3462:415:45",
"trueBody": {
"id": 45631,
"nodeType": "Block",
"src": "3496:277:45",
"statements": [
{
"assignments": [
45607
],
"declarations": [
{
"constant": false,
"id": 45607,
"mutability": "mutable",
"name": "liquidity0",
"nameLocation": "3518:10:45",
"nodeType": "VariableDeclaration",
"scope": 45631,
"src": "3510:18:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45606,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "3510:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"id": 45613,
"initialValue": {
"arguments": [
{
"id": 45609,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45566,
"src": "3554:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45610,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3568:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45611,
"name": "amount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45572,
"src": "3583:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45608,
"name": "getLiquidityForAmount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45526,
"src": "3531:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint160,uint160,uint256) pure returns (uint128)"
}
},
"id": 45612,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "3531:60:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "3510:81:45"
},
{
"assignments": [
45615
],
"declarations": [
{
"constant": false,
"id": 45615,
"mutability": "mutable",
"name": "liquidity1",
"nameLocation": "3613:10:45",
"nodeType": "VariableDeclaration",
"scope": 45631,
"src": "3605:18:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45614,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "3605:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"id": 45621,
"initialValue": {
"arguments": [
{
"id": 45617,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3649:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45618,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45566,
"src": "3664:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45619,
"name": "amount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45574,
"src": "3678:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45616,
"name": "getLiquidityForAmount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45563,
"src": "3626:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint160,uint160,uint256) pure returns (uint128)"
}
},
"id": 45620,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "3626:60:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "3605:81:45"
},
{
"expression": {
"id": 45629,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45622,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45577,
"src": "3701:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"condition": {
"commonType": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"id": 45625,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45623,
"name": "liquidity0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45607,
"src": "3713:10:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"id": 45624,
"name": "liquidity1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45615,
"src": "3726:10:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "3713:23:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseExpression": {
"id": 45627,
"name": "liquidity1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45615,
"src": "3752:10:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"id": 45628,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "Conditional",
"src": "3713:49:45",
"trueExpression": {
"id": 45626,
"name": "liquidity0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45607,
"src": "3739:10:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "3701:61:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"id": 45630,
"nodeType": "ExpressionStatement",
"src": "3701:61:45"
}
]
}
},
"id": 45642,
"nodeType": "IfStatement",
"src": "3323:554:45",
"trueBody": {
"id": 45602,
"nodeType": "Block",
"src": "3358:98:45",
"statements": [
{
"expression": {
"id": 45600,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45594,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45577,
"src": "3372:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45596,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45568,
"src": "3407:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45597,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45570,
"src": "3422:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45598,
"name": "amount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45572,
"src": "3437:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 45595,
"name": "getLiquidityForAmount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45526,
"src": "3384:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint256_$returns$_t_uint128_$",
"typeString": "function (uint160,uint160,uint256) pure returns (uint128)"
}
},
"id": 45599,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "3384:61:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"src": "3372:73:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"id": 45601,
"nodeType": "ExpressionStatement",
"src": "3372:73:45"
}
]
}
}
]
},
"documentation": {
"id": 45564,
"nodeType": "StructuredDocumentation",
"src": "2388:589:45",
"text": "@notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current\n pool prices and the prices at the tick boundaries\n @param sqrtRatioX96 A sqrt price representing the current pool prices\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param amount0 The amount of token0 being sent in\n @param amount1 The amount of token1 being sent in\n @return liquidity The maximum amount of liquidity received"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getLiquidityForAmounts",
"nameLocation": "2991:22:45",
"parameters": {
"id": 45575,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45566,
"mutability": "mutable",
"name": "sqrtRatioX96",
"nameLocation": "3031:12:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3023:20:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45565,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "3023:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45568,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "3061:13:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3053:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45567,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "3053:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45570,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "3092:13:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3084:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45569,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "3084:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45572,
"mutability": "mutable",
"name": "amount0",
"nameLocation": "3123:7:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3115:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45571,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3115:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45574,
"mutability": "mutable",
"name": "amount1",
"nameLocation": "3148:7:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3140:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45573,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3140:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "3013:148:45"
},
"returnParameters": {
"id": 45578,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45577,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "3193:9:45",
"nodeType": "VariableDeclaration",
"scope": 45644,
"src": "3185:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45576,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "3185:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "3184:19:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"id": 45686,
"nodeType": "FunctionDefinition",
"src": "4241:498:45",
"nodes": [],
"body": {
"id": 45685,
"nodeType": "Block",
"src": "4408:331:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45658,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45656,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45647,
"src": "4422:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45657,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45649,
"src": "4438:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "4422:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45667,
"nodeType": "IfStatement",
"src": "4418:98:45",
"trueBody": {
"expression": {
"id": 45665,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45659,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45647,
"src": "4454:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45660,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45649,
"src": "4469:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45661,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "4453:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45662,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45649,
"src": "4487:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45663,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45647,
"src": "4502:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45664,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "4486:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "4453:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45666,
"nodeType": "ExpressionStatement",
"src": "4453:63:45"
}
},
{
"expression": {
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 45683,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 45676,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [
{
"id": 45672,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45651,
"src": "4587:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
],
"id": 45671,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "4579:7:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": {
"id": 45670,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4579:7:45",
"typeDescriptions": {}
}
},
"id": 45673,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "4579:18:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<<",
"rightExpression": {
"expression": {
"id": 45674,
"name": "FixedPoint96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44338,
"src": "4601:12:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FixedPoint96_$44338_$",
"typeString": "type(library FixedPoint96)"
}
},
"id": 45675,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "4614:10:45",
"memberName": "RESOLUTION",
"nodeType": "MemberAccess",
"referencedDeclaration": 44334,
"src": "4601:23:45",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"src": "4579:45:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45679,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45677,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45649,
"src": "4642:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 45678,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45647,
"src": "4658:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "4642:29:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45680,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45649,
"src": "4689:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
],
"expression": {
"id": 45668,
"name": "FullMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44519,
"src": "4546:8:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FullMath_$44519_$",
"typeString": "type(library FullMath)"
}
},
"id": 45669,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "4555:6:45",
"memberName": "mulDiv",
"nodeType": "MemberAccess",
"referencedDeclaration": 44474,
"src": "4546:15:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 45681,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "4546:170:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"id": 45682,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45647,
"src": "4719:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "4546:186:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 45655,
"id": 45684,
"nodeType": "Return",
"src": "4527:205:45"
}
]
},
"documentation": {
"id": 45645,
"nodeType": "StructuredDocumentation",
"src": "3889:347:45",
"text": "@notice Computes the amount of token0 for a given amount of liquidity and a price range\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param liquidity The liquidity being valued\n @return amount0 The amount of token0"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getAmount0ForLiquidity",
"nameLocation": "4250:22:45",
"parameters": {
"id": 45652,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45647,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "4290:13:45",
"nodeType": "VariableDeclaration",
"scope": 45686,
"src": "4282:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45646,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "4282:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45649,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "4321:13:45",
"nodeType": "VariableDeclaration",
"scope": 45686,
"src": "4313:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45648,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "4313:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45651,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "4352:9:45",
"nodeType": "VariableDeclaration",
"scope": 45686,
"src": "4344:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45650,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "4344:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "4272:95:45"
},
"returnParameters": {
"id": 45655,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45654,
"mutability": "mutable",
"name": "amount0",
"nameLocation": "4399:7:45",
"nodeType": "VariableDeclaration",
"scope": 45686,
"src": "4391:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45653,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "4391:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "4390:17:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"id": 45721,
"nodeType": "FunctionDefinition",
"src": "5097:375:45",
"nodes": [],
"body": {
"id": 45720,
"nodeType": "Block",
"src": "5264:208:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45700,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45698,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45689,
"src": "5278:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45699,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45691,
"src": "5294:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "5278:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45709,
"nodeType": "IfStatement",
"src": "5274:98:45",
"trueBody": {
"expression": {
"id": 45707,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45701,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45689,
"src": "5310:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45702,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45691,
"src": "5325:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45703,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "5309:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45704,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45691,
"src": "5343:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45705,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45689,
"src": "5358:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45706,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "5342:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "5309:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45708,
"nodeType": "ExpressionStatement",
"src": "5309:63:45"
}
},
{
"expression": {
"arguments": [
{
"id": 45712,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45693,
"src": "5406:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
{
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45715,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45713,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45691,
"src": "5417:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"id": 45714,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45689,
"src": "5433:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "5417:29:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"expression": {
"id": 45716,
"name": "FixedPoint96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44338,
"src": "5448:12:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FixedPoint96_$44338_$",
"typeString": "type(library FixedPoint96)"
}
},
"id": 45717,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "5461:3:45",
"memberName": "Q96",
"nodeType": "MemberAccess",
"referencedDeclaration": 44337,
"src": "5448:16:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"id": 45710,
"name": "FullMath",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44519,
"src": "5390:8:45",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_FullMath_$44519_$",
"typeString": "type(library FullMath)"
}
},
"id": 45711,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "5399:6:45",
"memberName": "mulDiv",
"nodeType": "MemberAccess",
"referencedDeclaration": 44474,
"src": "5390:15:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 45718,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "5390:75:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 45697,
"id": 45719,
"nodeType": "Return",
"src": "5383:82:45"
}
]
},
"documentation": {
"id": 45687,
"nodeType": "StructuredDocumentation",
"src": "4745:347:45",
"text": "@notice Computes the amount of token1 for a given amount of liquidity and a price range\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param liquidity The liquidity being valued\n @return amount1 The amount of token1"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getAmount1ForLiquidity",
"nameLocation": "5106:22:45",
"parameters": {
"id": 45694,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45689,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "5146:13:45",
"nodeType": "VariableDeclaration",
"scope": 45721,
"src": "5138:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45688,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "5138:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45691,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "5177:13:45",
"nodeType": "VariableDeclaration",
"scope": 45721,
"src": "5169:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45690,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "5169:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45693,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "5208:9:45",
"nodeType": "VariableDeclaration",
"scope": 45721,
"src": "5200:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45692,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "5200:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "5128:95:45"
},
"returnParameters": {
"id": 45697,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45696,
"mutability": "mutable",
"name": "amount1",
"nameLocation": "5255:7:45",
"nodeType": "VariableDeclaration",
"scope": 45721,
"src": "5247:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45695,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "5247:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "5246:17:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"id": 45793,
"nodeType": "FunctionDefinition",
"src": "6013:799:45",
"nodes": [],
"body": {
"id": 45792,
"nodeType": "Block",
"src": "6227:585:45",
"nodes": [],
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45739,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45737,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6241:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"id": 45738,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6257:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "6241:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 45748,
"nodeType": "IfStatement",
"src": "6237:98:45",
"trueBody": {
"expression": {
"id": 45746,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"components": [
{
"id": 45740,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6273:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45741,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6288:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45742,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "6272:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"components": [
{
"id": 45743,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6306:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45744,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6321:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
}
],
"id": 45745,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "6305:30:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_uint160_$_t_uint160_$",
"typeString": "tuple(uint160,uint160)"
}
},
"src": "6272:63:45",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 45747,
"nodeType": "ExpressionStatement",
"src": "6272:63:45"
}
},
{
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45751,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45749,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45724,
"src": "6350:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "<=",
"rightExpression": {
"id": 45750,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6366:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "6350:29:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"condition": {
"commonType": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"id": 45763,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 45761,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45724,
"src": "6489:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"id": 45762,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6504:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"src": "6489:28:45",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 45789,
"nodeType": "Block",
"src": "6708:98:45",
"statements": [
{
"expression": {
"id": 45787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45781,
"name": "amount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45735,
"src": "6722:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45783,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6755:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45784,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6770:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45785,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45730,
"src": "6785:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
],
"id": 45782,
"name": "getAmount1ForLiquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45721,
"src": "6732:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint128_$returns$_t_uint256_$",
"typeString": "function (uint160,uint160,uint128) pure returns (uint256)"
}
},
"id": 45786,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "6732:63:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6722:73:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 45788,
"nodeType": "ExpressionStatement",
"src": "6722:73:45"
}
]
},
"id": 45790,
"nodeType": "IfStatement",
"src": "6485:321:45",
"trueBody": {
"id": 45780,
"nodeType": "Block",
"src": "6519:183:45",
"statements": [
{
"expression": {
"id": 45770,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45764,
"name": "amount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45733,
"src": "6533:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45766,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45724,
"src": "6566:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45767,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6580:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45768,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45730,
"src": "6595:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
],
"id": 45765,
"name": "getAmount0ForLiquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45686,
"src": "6543:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint128_$returns$_t_uint256_$",
"typeString": "function (uint160,uint160,uint128) pure returns (uint256)"
}
},
"id": 45769,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "6543:62:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6533:72:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 45771,
"nodeType": "ExpressionStatement",
"src": "6533:72:45"
},
{
"expression": {
"id": 45778,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45772,
"name": "amount1",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45735,
"src": "6619:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45774,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6652:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45775,
"name": "sqrtRatioX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45724,
"src": "6667:12:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45776,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45730,
"src": "6681:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
],
"id": 45773,
"name": "getAmount1ForLiquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45721,
"src": "6629:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint128_$returns$_t_uint256_$",
"typeString": "function (uint160,uint160,uint128) pure returns (uint256)"
}
},
"id": 45777,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "6629:62:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6619:72:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 45779,
"nodeType": "ExpressionStatement",
"src": "6619:72:45"
}
]
}
},
"id": 45791,
"nodeType": "IfStatement",
"src": "6346:460:45",
"trueBody": {
"id": 45760,
"nodeType": "Block",
"src": "6381:98:45",
"statements": [
{
"expression": {
"id": 45758,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 45752,
"name": "amount0",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45733,
"src": "6395:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"id": 45754,
"name": "sqrtRatioAX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45726,
"src": "6428:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45755,
"name": "sqrtRatioBX96",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45728,
"src": "6443:13:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
{
"id": 45756,
"name": "liquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45730,
"src": "6458:9:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
{
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
],
"id": 45753,
"name": "getAmount0ForLiquidity",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 45686,
"src": "6405:22:45",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint160_$_t_uint160_$_t_uint128_$returns$_t_uint256_$",
"typeString": "function (uint160,uint160,uint128) pure returns (uint256)"
}
},
"id": 45757,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "6405:63:45",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "6395:73:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 45759,
"nodeType": "ExpressionStatement",
"src": "6395:73:45"
}
]
}
}
]
},
"documentation": {
"id": 45722,
"nodeType": "StructuredDocumentation",
"src": "5478:530:45",
"text": "@notice Computes the token0 and token1 value for a given amount of liquidity, the current\n pool prices and the prices at the tick boundaries\n @param sqrtRatioX96 A sqrt price representing the current pool prices\n @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n @param liquidity The liquidity being valued\n @return amount0 The amount of token0\n @return amount1 The amount of token1"
},
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getAmountsForLiquidity",
"nameLocation": "6022:22:45",
"parameters": {
"id": 45731,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45724,
"mutability": "mutable",
"name": "sqrtRatioX96",
"nameLocation": "6062:12:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6054:20:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45723,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "6054:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45726,
"mutability": "mutable",
"name": "sqrtRatioAX96",
"nameLocation": "6092:13:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6084:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45725,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "6084:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45728,
"mutability": "mutable",
"name": "sqrtRatioBX96",
"nameLocation": "6123:13:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6115:21:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
},
"typeName": {
"id": 45727,
"name": "uint160",
"nodeType": "ElementaryTypeName",
"src": "6115:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint160",
"typeString": "uint160"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45730,
"mutability": "mutable",
"name": "liquidity",
"nameLocation": "6154:9:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6146:17:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
},
"typeName": {
"id": 45729,
"name": "uint128",
"nodeType": "ElementaryTypeName",
"src": "6146:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint128",
"typeString": "uint128"
}
},
"visibility": "internal"
}
],
"src": "6044:125:45"
},
"returnParameters": {
"id": 45736,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 45733,
"mutability": "mutable",
"name": "amount0",
"nameLocation": "6201:7:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6193:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45732,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6193:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 45735,
"mutability": "mutable",
"name": "amount1",
"nameLocation": "6218:7:45",
"nodeType": "VariableDeclaration",
"scope": 45793,
"src": "6210:15:45",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45734,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "6210:7:45",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "6192:34:45"
},
"scope": 45794,
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"abstract": false,
"baseContracts": [],
"canonicalName": "LiquidityAmounts",
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 45459,
"nodeType": "StructuredDocumentation",
"src": "196:131:45",
"text": "@title Liquidity amount functions\n @notice Provides functions for computing liquidity amounts from token amounts and prices"
},
"fullyImplemented": true,
"linearizedBaseContracts": [
45794
],
"name": "LiquidityAmounts",
"nameLocation": "335:16:45",
"scope": 45795,
"usedErrors": [],
"usedEvents": []
}
],
"license": "GPL-2.0-or-later"
},
"id": 45
}