UNPKG

hardlydifficult-eth

Version:

A collection of reusable contracts and Javascript helpers for Ethereum.

1,057 lines (1,056 loc) 148 kB
{ "contractName": "UniswapV2OracleLibrary", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol\":\"UniswapV2OracleLibrary\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"@uniswap/lib/contracts/libraries/Babylonian.sol\":{\"keccak256\":\"0x2799682d733a6ef3aae1dce7dbe2cff5513f0244e4abd07338fe7a45c8fd9733\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://332968199300fe6025b9ad8f3d69f252ec2a3a092fa42a0ef7f2d1397f59a7e5\",\"dweb:/ipfs/Qme4wBzDwfHr7zHk8WrCwCpozpt4KHuDQSxfJTDoHL8Pdi\"]},\"@uniswap/lib/contracts/libraries/BitMath.sol\":{\"keccak256\":\"0x0ef2d7cd41b3f1818fa41019b38948489238efccebe428d4b04919174378abf5\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://696ac37d8731506cbac9b428afb7bdfa35a490df139022be2b04ab3815113cf4\",\"dweb:/ipfs/QmUQ5ty49YATw4Gf5PrtFkxNErcnwhNUpRF3WFaVJxATf9\"]},\"@uniswap/lib/contracts/libraries/FixedPoint.sol\":{\"keccak256\":\"0x0e8d7f2bfad7505f9d029ea060eab9747363d50bf01f2d954bf719da6fac342f\",\"license\":\"GPL-3.0-or-later\",\"urls\":[\"bzz-raw://35dd605e2fd59d2606529ab1575cd937082018cd041cfbb843b68e97e440b9b0\",\"dweb:/ipfs/QmUHbzyCdzwUSCUPVFFm9N6oKXiisVdscX8H73nwNXmmpV\"]},\"@uniswap/lib/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xf3dd7fc13a7eee86c17cdfe13b03a7f24ebaf09588550b64b581ae7b2bd59273\",\"license\":\"CC-BY-4.0\",\"urls\":[\"bzz-raw://492ced3afa929c790c9b1314b86454a977528e8f3d408a55b1275a396154d097\",\"dweb:/ipfs/QmbX2YAgtoM13Z2MRnV5WnUpzmw3fMxmhzCnsKKxQUjGJJ\"]},\"@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol\":{\"keccak256\":\"0x7c9bc70e5996c763e02ff38905282bc24fb242b0ef2519a003b36824fc524a4b\",\"urls\":[\"bzz-raw://85d5ad2dd23ee127f40907a12865a1e8cb5828814f6f2480285e1827dd72dedf\",\"dweb:/ipfs/QmayKQWJgWmr46DqWseADyUanmqxh662hPNdAkdHRjiQQH\"]},\"@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol\":{\"keccak256\":\"0x993538630a9568290c39140d54c034a66cf1b95cdeef4ba804a948c4ee2fc311\",\"urls\":[\"bzz-raw://adff017b539750d5ac84403360967c4d6b02a1ee9b8f2487f0bcddd7fa7c523e\",\"dweb:/ipfs/QmQqUiUvoezf33f2SZa64M8KgksHSXFPrGuwDvxijtXYMo\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a4b8a9b59bd8501a0653769cbff62397fe806777c87b87d7d51581f62e26749564736f6c634300060a0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a4b8a9b59bd8501a0653769cbff62397fe806777c87b87d7d51581f62e26749564736f6c634300060a0033", "immutableReferences": {}, "sourceMap": "244:1444:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "244:1444:8:-:0;;;;;;;;", "source": "pragma solidity >=0.5.0;\n\nimport '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';\nimport '@uniswap/lib/contracts/libraries/FixedPoint.sol';\n\n// library with helper methods for oracles that are concerned with computing average prices\nlibrary UniswapV2OracleLibrary {\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 = IUniswapV2Pair(pair).price0CumulativeLast();\n price1Cumulative = IUniswapV2Pair(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) = IUniswapV2Pair(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": "@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol", "ast": { "absolutePath": "@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol", "exportedSymbols": { "UniswapV2OracleLibrary": [ 1791 ] }, "id": 1792, "license": null, "nodeType": "SourceUnit", "nodes": [ { "id": 1686, "literals": [ "solidity", ">=", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:24:8" }, { "absolutePath": "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol", "file": "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol", "id": 1687, "nodeType": "ImportDirective", "scope": 1792, "sourceUnit": 1685, "src": "26:66:8", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@uniswap/lib/contracts/libraries/FixedPoint.sol", "file": "@uniswap/lib/contracts/libraries/FixedPoint.sol", "id": 1688, "nodeType": "ImportDirective", "scope": 1792, "sourceUnit": 1167, "src": "93:57:8", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 1791, "linearizedBaseContracts": [ 1791 ], "name": "UniswapV2OracleLibrary", "nodeType": "ContractDefinition", "nodes": [ { "id": 1690, "libraryName": { "contractScope": null, "id": 1689, "name": "FixedPoint", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1166, "src": "287:10:8", "typeDescriptions": { "typeIdentifier": "t_contract$_FixedPoint_$1166", "typeString": "library FixedPoint" } }, "nodeType": "UsingForDirective", "src": "281:23:8", "typeName": null }, { "body": { "id": 1705, "nodeType": "Block", "src": "486:57:8", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 1702, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 1697, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -4, "src": "510:5:8", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 1698, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "timestamp", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "510:15:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_4294967296_by_1", "typeString": "int_const 4294967296" }, "id": 1701, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "32", "id": 1699, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "528:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "hexValue": "3332", "id": 1700, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "533:2:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "528:7:8", "typeDescriptions": { "typeIdentifier": "t_rational_4294967296_by_1", "typeString": "int_const 4294967296" } }, "src": "510:25:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 1696, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "503:6:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint32_$", "typeString": "type(uint32)" }, "typeName": { "id": 1695, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "503:6:8", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 1703, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "503:33:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "functionReturnParameters": 1694, "id": 1704, "nodeType": "Return", "src": "496:40:8" } ] }, "documentation": null, "id": 1706, "implemented": true, "kind": "function", "modifiers": [], "name": "currentBlockTimestamp", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 1691, "nodeType": "ParameterList", "parameters": [], "src": "452:2:8" }, "returnParameters": { "id": 1694, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1693, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1706, "src": "478:6:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 1692, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "478:6:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "src": "477:8:8" }, "scope": 1791, "src": "422:121:8", "stateMutability": "view", "virtual": false, "visibility": "internal" }, { "body": { "id": 1789, "nodeType": "Block", "src": "799:887:8", "statements": [ { "expression": { "argumentTypes": null, "id": 1720, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 1717, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1715, "src": "809:14:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 1718, "name": "currentBlockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1706, "src": "826:21:8", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$_t_uint32_$", "typeString": "function () view returns (uint32)" } }, "id": 1719, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "826:23:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "809:40:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "id": 1721, "nodeType": "ExpressionStatement", "src": "809:40:8" }, { "expression": { "argumentTypes": null, "id": 1728, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 1722, "name": "price0Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1711, "src": "859:16:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1724, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1708, "src": "893:4:8", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 1723, "name": "IUniswapV2Pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1684, "src": "878:14:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IUniswapV2Pair_$1684_$", "typeString": "type(contract IUniswapV2Pair)" } }, "id": 1725, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "878:20:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$1684", "typeString": "contract IUniswapV2Pair" } }, "id": 1726, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "price0CumulativeLast", "nodeType": "MemberAccess", "referencedDeclaration": 1631, "src": "878:41:8", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 1727, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "878:43:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "859:62:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 1729, "nodeType": "ExpressionStatement", "src": "859:62:8" }, { "expression": { "argumentTypes": null, "id": 1736, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 1730, "name": "price1Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1713, "src": "931:16:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1732, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1708, "src": "965:4:8", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 1731, "name": "IUniswapV2Pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1684, "src": "950:14:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IUniswapV2Pair_$1684_$", "typeString": "type(contract IUniswapV2Pair)" } }, "id": 1733, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "950:20:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$1684", "typeString": "contract IUniswapV2Pair" } }, "id": 1734, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "price1CumulativeLast", "nodeType": "MemberAccess", "referencedDeclaration": 1636, "src": "950:41:8", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$", "typeString": "function () view external returns (uint256)" } }, "id": 1735, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "950:43:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "931:62:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 1737, "nodeType": "ExpressionStatement", "src": "931:62:8" }, { "assignments": [ 1739, 1741, 1743 ], "declarations": [ { "constant": false, "id": 1739, "mutability": "mutable", "name": "reserve0", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1789, "src": "1105:16:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" }, "typeName": { "id": 1738, "name": "uint112", "nodeType": "ElementaryTypeName", "src": "1105:7:8", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1741, "mutability": "mutable", "name": "reserve1", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1789, "src": "1123:16:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" }, "typeName": { "id": 1740, "name": "uint112", "nodeType": "ElementaryTypeName", "src": "1123:7:8", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1743, "mutability": "mutable", "name": "blockTimestampLast", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1789, "src": "1141:25:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 1742, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1141:6:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "id": 1749, "initialValue": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1745, "name": "pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1708, "src": "1185:4:8", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 1744, "name": "IUniswapV2Pair", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1684, "src": "1170:14:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IUniswapV2Pair_$1684_$", "typeString": "type(contract IUniswapV2Pair)" } }, "id": 1746, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1170:20:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IUniswapV2Pair_$1684", "typeString": "contract IUniswapV2Pair" } }, "id": 1747, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "getReserves", "nodeType": "MemberAccess", "referencedDeclaration": 1626, "src": "1170:32:8", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint112_$_t_uint112_$_t_uint32_$", "typeString": "function () view external returns (uint112,uint112,uint32)" } }, "id": 1748, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1170:34:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_uint112_$_t_uint112_$_t_uint32_$", "typeString": "tuple(uint112,uint112,uint32)" } }, "nodeType": "VariableDeclarationStatement", "src": "1104:100:8" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "id": 1752, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 1750, "name": "blockTimestampLast", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1743, "src": "1218:18:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "id": 1751, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1715, "src": "1240:14:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "1218:36:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 1788, "nodeType": "IfStatement", "src": "1214:466:8", "trueBody": { "id": 1787, "nodeType": "Block", "src": "1256:424:8", "statements": [ { "assignments": [ 1754 ], "declarations": [ { "constant": false, "id": 1754, "mutability": "mutable", "name": "timeElapsed", "nodeType": "VariableDeclaration", "overrides": null, "scope": 1787, "src": "1317:18:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 1753, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1317:6:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "value": null, "visibility": "internal" } ], "id": 1758, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "id": 1757, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 1755, "name": "blockTimestamp", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1715, "src": "1338:14:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 1756, "name": "blockTimestampLast", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1743, "src": "1355:18:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "src": "1338:35:8", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "nodeType": "VariableDeclarationStatement", "src": "1317:56:8" }, { "expression": { "argumentTypes": null, "id": 1771, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 1759, "name": "price0Cumulative", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1711, "src": "1461:16:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 1770, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 1764, "name": "reserve1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1741, "src": "1506:8:8", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } }, { "argumentTypes": null, "id": 1765, "name": "reserve0", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1739, "src": "1516:8:8", "typeDescriptions": { "typeIdentifier": "t_uint112", "typeString": "uint112" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint112", "typeString": "uint112" }, { "typeIdentifier": "t_uint112", "typeString": "uint112" } ], "expression": { "argumentTypes": null, "id": 1762, "name": "FixedPoint", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1166, "src": "1486:10:8", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_FixedPoint_$1166_$", "typeString": "type(library FixedPoint)" } }, "id": 1763, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "fraction", "nodeType": "MemberAccess", "referencedDeclaration": 1065, "src": "1486:19:8", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint112_$_t_uint112_$returns$_t_struct$_uq112x112_$614_memory_ptr_$", "typeString": "function (uint112,uint112) pure returns (struct FixedPoint.uq112x112 memory)" } }, "id": 1766, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1486:39:8", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_struct$_uq112x112_$614_memory_ptr", "typeString": "struct FixedPoint.uq112x112 memory" } }, "id": 1767, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false,