UNPKG

moonwalkerswap-v2-periphery

Version:
1,046 lines 149 kB
{ "contractName": "MoonwalkerswapV2OracleLibrary", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.6+commit.6c089d02\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2OracleLibrary.sol\":\"MoonwalkerswapV2OracleLibrary\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2OracleLibrary.sol\":{\"keccak256\":\"0xba3132e913c4a8df1d1a37232555e20241d03d6e780e43e57db0e0a06c1b3d85\",\"urls\":[\"bzz-raw://98b59420f5c45cada35ee2f1d9ef925457b288d96d7f5c2e9ba0efa0b17e7478\",\"dweb:/ipfs/QmX61qAUFrhg2LsfZ76x81yVdgMHj2G3SvoRdfLf12riHk\"]},\"moonwalkerswap-libraries/contracts/libraries/Babylonian.sol\":{\"keccak256\":\"0xeb1c2a281a00f4660775f75ccfa1e51fbe1d75f86aeb9d0d297151ecdb900177\",\"urls\":[\"bzz-raw://68515f0265381bddfb1d1356ea10ce4e5784276fc09f197fcdcedfa5c75cc069\",\"dweb:/ipfs/QmXWVVPnuJwRUAu3Qpu1s7Fyc5WPQxmZPczVEe5cJ5wVHZ\"]},\"moonwalkerswap-libraries/contracts/libraries/BitMath.sol\":{\"keccak256\":\"0x19f84d5268286794b44939ec0d85b3c6f59e133f826cdbd9e40112fc94919bb7\",\"urls\":[\"bzz-raw://d21c67ed58cf667d052e141df2fba76c46c159edcc45eb897c908c20c69d2727\",\"dweb:/ipfs/QmUyKz1992wgR8nYAzBuQzjBAKMxLAN3hTgzpYJxusbmVH\"]},\"moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol\":{\"keccak256\":\"0xc3a39b8a11715cea45ad9f67f50e4e4c33778c1124acd59e90daf064c9a93974\",\"urls\":[\"bzz-raw://2c6c3cdcdb30caa5d15477550003b5dbb174cb2c0be3c012af030fce3d043f28\",\"dweb:/ipfs/QmWh3n5g6zq3umJcURnKCFhhif2c8yb6mKczFjfoCNLC3g\"]},\"moonwalkerswap-libraries/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xc4ffcf28169f73fc9fdd1f82345d6d4fcccf3fd5aea83c133437c25e4e0950a9\",\"urls\":[\"bzz-raw://c9257a47501005f0a648bc4801ef4abc33843681aaf03a6d0c43d46b69e37407\",\"dweb:/ipfs/QmciHvDrqhxs5fjsrm9aNq29FZXpunMn17n2wWj83Zsh3B\"]},\"moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol\":{\"keccak256\":\"0x4c888477bfd9725859e9136902f4e0e2b00c1f60fa640083226cb04a2e6e2b2d\",\"urls\":[\"bzz-raw://6bdfa268dbce3f14b7a324c84094d2aa4b51764a344c61eb7e7d179ca54f6861\",\"dweb:/ipfs/QmcGAFVuybBuNyp8Woza32E8T1Dsh9nrrCgecmHEazFTx6\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220737434dd58f05f11f8ea137ab93e76187488b1327ba2f16b558c0fc8946a07ce64736f6c63430006060033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220737434dd58f05f11f8ea137ab93e76187488b1327ba2f16b558c0fc8946a07ce64736f6c63430006060033", "immutableReferences": {}, "sourceMap": "263:1454:12:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", "deployedSourceMap": "263:1454:12:-:0;;;;;;12:1:-1;9;2:12", "source": "pragma solidity >=0.5.0;\n\nimport 'moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol';\nimport 'moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol';\n\n// library with helper methods for oracles that are concerned with computing average prices\nlibrary MoonwalkerswapV2OracleLibrary {\n using FixedPoint for *;\n\n // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]\n function currentBlockTimestamp() internal view returns (uint32) {\n return uint32(block.timestamp % 2 ** 32);\n }\n\n // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\n function currentCumulativePrices(\n address pair\n ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {\n blockTimestamp = currentBlockTimestamp();\n price0Cumulative = IMoonwalkerPair(pair).price0CumulativeLast();\n price1Cumulative = IMoonwalkerPair(pair).price1CumulativeLast();\n\n // if time has elapsed since the last update on the pair, mock the accumulated price values\n (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IMoonwalkerPair(pair).getReserves();\n if (blockTimestampLast != blockTimestamp) {\n // subtraction overflow is desired\n uint32 timeElapsed = blockTimestamp - blockTimestampLast;\n // addition overflow is desired\n // counterfactual\n price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;\n // counterfactual\n price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;\n }\n }\n}\n", "sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2OracleLibrary.sol", "ast": { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/Moonwalkerswap-v2-periphery/contracts/libraries/MoonwalkerswapV2OracleLibrary.sol", "exportedSymbols": { "MoonwalkerswapV2OracleLibrary": [ 5292 ] }, "id": 5293, "nodeType": "SourceUnit", "nodes": [ { "id": 5187, "literals": [ "solidity", ">=", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:24:12" }, { "absolutePath": "moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol", "file": "moonwalkerswap-v2-core/contracts/interfaces/IMoonwalkerPair.sol", "id": 5188, "nodeType": "ImportDirective", "scope": 5293, "sourceUnit": 8545, "src": "26:73:12", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol", "file": "moonwalkerswap-libraries/contracts/libraries/FixedPoint.sol", "id": 5189, "nodeType": "ImportDirective", "scope": 5293, "sourceUnit": 7859, "src": "100:69:12", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 5292, "linearizedBaseContracts": [ 5292 ], "name": "MoonwalkerswapV2OracleLibrary", "nodeType": "ContractDefinition", "nodes": [ { "id": 5191, "libraryName": { "contractScope": null, "id": 5190, "name": "FixedPoint", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 7858, "src": "313:10:12", "typeDescriptions": { "typeIdentifier": "t_contract$_FixedPoint_$7858", "typeString": "library FixedPoint" } }, "nodeType": "UsingForDirective", "src": "307:23:12", "typeName": null }, { "body": { "id": 5206, "nodeType": "Block", "src": "512:57:12", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 5203, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 5198, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -4, "src": "536:5:12", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 5199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "timestamp", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "536:15:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_4294967296_by_1", "typeString": "int_const 4294967296" }, "id": 5202, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "32", "id": 5200, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "554:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "hexValue": "3332", "id": 5201, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "559:2:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "554:7:12", "typeDescriptions": { "typeIdentifier": "t_rational_4294967296_by_1", "typeString": "int_const 4294967296" } }, "src": "536:25:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 5197, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "529:6:12", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint32_$", "typeString": "type(uint32)" }, "typeName": { "id": 5196, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "529:6:12", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 5204, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "529:33:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "functionReturnParameters": 5195, "id": 5205, "nodeType": "Return", "src": "522:40:12" } ] }, "documentation": null, "id": 5207, "implemented": true, "kind": "function", "modifiers": [], "name": "currentBlockTimestamp", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5192, "nodeType": "ParameterList", "parameters": [], "src": "478:2:12" }, "returnParameters": { "id": 5195, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5194, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5207, "src": "504:6:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 5193, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "504:6:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "src": "503:8:12" }, "scope": 5292, "src": "448:121:12", "stateMutability": "view", "virtual": false, "visibility": "internal" }, { "body": { "id": 5290, "nodeType": "Block", "src": "825:890:12", "statements": [ { "expression": { "argumentTypes": null, "id": 5221, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 5218, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5216, "src": "835:14:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 5219, "name": "currentBlockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5207, "src": "852:21:12", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint32_$", "typeString": "function () view returns (uint32)" } }, "id": 5220, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "852:23:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "835:40:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "id": 5222, "nodeType": "ExpressionStatement", "src": "835:40:12" }, { "expression": { "argumentTypes": null, "id": 5229, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 5223, "name": "price0Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5212, "src": "885:16:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5225, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5209, "src": "920:4:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5224, "name": "IMoonwalkerPair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 8544, "src": "904:15:12", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IMoonwalkerPair_$8544_$", "typeString": "type(contract IMoonwalkerPair)" } }, "id": 5226, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "904:21:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IMoonwalkerPair_$8544", "typeString": "contract IMoonwalkerPair" } }, "id": 5227, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "price0CumulativeLast", "nodeType": "MemberAccess", "referencedDeclaration": 8491, "src": "904:42:12", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 5228, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "904:44:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "885:63:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 5230, "nodeType": "ExpressionStatement", "src": "885:63:12" }, { "expression": { "argumentTypes": null, "id": 5237, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 5231, "name": "price1Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5214, "src": "958:16:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5233, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5209, "src": "993:4:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5232, "name": "IMoonwalkerPair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 8544, "src": "977:15:12", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IMoonwalkerPair_$8544_$", "typeString": "type(contract IMoonwalkerPair)" } }, "id": 5234, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "977:21:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IMoonwalkerPair_$8544", "typeString": "contract IMoonwalkerPair" } }, "id": 5235, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "price1CumulativeLast", "nodeType": "MemberAccess", "referencedDeclaration": 8496, "src": "977:42:12", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 5236, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "977:44:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "958:63:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 5238, "nodeType": "ExpressionStatement", "src": "958:63:12" }, { "assignments": [ 5240, 5242, 5244 ], "declarations": [ { "constant": false, "id": 5240, "mutability": "mutable", "name": "reserve0", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5290, "src": "1133:16:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" }, "typeName": { "id": 5239, "name": "uint112", "nodeType": "ElementaryTypeName", "src": "1133:7:12", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5242, "mutability": "mutable", "name": "reserve1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5290, "src": "1151:16:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" }, "typeName": { "id": 5241, "name": "uint112", "nodeType": "ElementaryTypeName", "src": "1151:7:12", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5244, "mutability": "mutable", "name": "blockTimestampLast", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5290, "src": "1169:25:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 5243, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1169:6:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "id": 5250, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5246, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5209, "src": "1214:4:12", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 5245, "name": "IMoonwalkerPair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 8544, "src": "1198:15:12", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IMoonwalkerPair_$8544_$", "typeString": "type(contract IMoonwalkerPair)" } }, "id": 5247, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1198:21:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IMoonwalkerPair_$8544", "typeString": "contract IMoonwalkerPair" } }, "id": 5248, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "getReserves", "nodeType": "MemberAccess", "referencedDeclaration": 8486, "src": "1198:33:12", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint112_$_t_uint112_$_t_uint32_$", "typeString": "function () view external returns (uint112,uint112,uint32)" } }, "id": 5249, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1198:35:12", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint112_$_t_uint112_$_t_uint32_$", "typeString": "tuple(uint112,uint112,uint32)" } }, "nodeType": "VariableDeclarationStatement", "src": "1132:101:12" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "id": 5253, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 5251, "name": "blockTimestampLast", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5244, "src": "1247:18:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 5252, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5216, "src": "1269:14:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "1247:36:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 5289, "nodeType": "IfStatement", "src": "1243:466:12", "trueBody": { "id": 5288, "nodeType": "Block", "src": "1285:424:12", "statements": [ { "assignments": [ 5255 ], "declarations": [ { "constant": false, "id": 5255, "mutability": "mutable", "name": "timeElapsed", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5288, "src": "1346:18:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 5254, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1346:6:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "id": 5259, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "id": 5258, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 5256, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5216, "src": "1367:14:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 5257, "name": "blockTimestampLast", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5244, "src": "1384:18:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "1367:35:12", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "VariableDeclarationStatement", "src": "1346:56:12" }, { "expression": { "argumentTypes": null, "id": 5272, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 5260, "name": "price0Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5212, "src": "1490:16:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 5271, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 5265, "name": "reserve1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5242, "src": "1535:8:12", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, { "argumentTypes": null, "id": 5266, "name": "reserve0", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5240, "src": "1545:8:12", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint112", "typeString": "uint112" }, { "typeIdentifier": "t_uint112", "typeString": "uint112" } ], "expression": { "argumentTypes": null, "id": 5263, "name": "FixedPoint", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7858, "src": "1515:10:12", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_FixedPoint_$7858_$", "typeString": "type(library FixedPoint)" } }, "id": 5264, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "fraction", "nodeType": "MemberAccess", "referencedDeclaration": 7749, "src": "1515:19:12", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_struct$_uq112x112_$7237_memory_ptr_$", "typeString": "function (uint256,uint256) pure returns (struct FixedPoint.uq112x112 memory)" } }, "id": 5267, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1515:39:12", "tryCall": false, "typeDescrip