UNPKG

moonwalkerswap-v1-core

Version:
1,080 lines (1,079 loc) 238 kB
{ "contractName": "FullMath", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Contains 512-bit math functions\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol\":\"FullMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xe511530871deaef86692cea9adb6076d26d7b47fd4815ce51af52af981026057\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc5a6ae776be3e7dcbd23d49ffbc9d792fed0ddf4b111ebb64b9bb2133ec263e\",\"dweb:/ipfs/QmbAUtWqvipzEARQpFpkzYKBELy3qeW5WXnZxHFU84sxG7\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220fb8b39d2d83b7038641fb0ecf6616026824f54e1dc42a9d2fc7925cdfd3105ea64736f6c63430007060033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220fb8b39d2d83b7038641fb0ecf6616026824f54e1dc42a9d2fc7925cdfd3105ea64736f6c63430007060033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "355:4762:20:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "355:4762:20:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = -denominator & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n}\n", "sourcePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol", "ast": { "absolutePath": "/Users/warrenmason/Documents/UniswapV3Contracts/Core/LiveContracts/MoonwalkerSwap-v1-Core/contracts/libraries/FullMath.sol", "exportedSymbols": { "FullMath": [ 3990 ] }, "id": 3991, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 3819, "literals": [ "solidity", ">=", "0.4", ".0" ], "nodeType": "PragmaDirective", "src": "32:24:20" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 3820, "nodeType": "StructuredDocumentation", "src": "58:297:20", "text": "@title Contains 512-bit math functions\n @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits" }, "fullyImplemented": true, "id": 3990, "linearizedBaseContracts": [ 3990 ], "name": "FullMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 3945, "nodeType": "Block", "src": "870:3648:20", "statements": [ { "assignments": [ 3833 ], "declarations": [ { "constant": false, "id": 3833, "mutability": "mutable", "name": "prod0", "nodeType": "VariableDeclaration", "scope": 3945, "src": "1183:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3832, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1183:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 3834, "nodeType": "VariableDeclarationStatement", "src": "1183:13:20" }, { "assignments": [ 3836 ], "declarations": [ { "constant": false, "id": 3836, "mutability": "mutable", "name": "prod1", "nodeType": "VariableDeclaration", "scope": 3945, "src": "1251:13:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3835, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1251:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 3837, "nodeType": "VariableDeclarationStatement", "src": "1251:13:20" }, { "AST": { "nodeType": "YulBlock", "src": "1327:141:20", "statements": [ { "nodeType": "YulVariableDeclaration", "src": "1341:30:20", "value": { "arguments": [ { "name": "a", "nodeType": "YulIdentifier", "src": "1358:1:20" }, { "name": "b", "nodeType": "YulIdentifier", "src": "1361:1:20" }, { "arguments": [ { "kind": "number", "nodeType": "YulLiteral", "src": "1368:1:20", "type": "", "value": "0" } ], "functionName": { "name": "not", "nodeType": "YulIdentifier", "src": "1364:3:20" }, "nodeType": "YulFunctionCall", "src": "1364:6:20" } ], "functionName": { "name": "mulmod", "nodeType": "YulIdentifier", "src": "1351:6:20" }, "nodeType": "YulFunctionCall", "src": "1351:20:20" }, "variables": [ { "name": "mm", "nodeType": "YulTypedName", "src": "1345:2:20", "type": "" } ] }, { "nodeType": "YulAssignment", "src": "1384:18:20", "value": { "arguments": [ { "name": "a", "nodeType": "YulIdentifier", "src": "1397:1:20" }, { "name": "b", "nodeType": "YulIdentifier", "src": "1400:1:20" } ], "functionName": { "name": "mul", "nodeType": "YulIdentifier", "src": "1393:3:20" }, "nodeType": "YulFunctionCall", "src": "1393:9:20" }, "variableNames": [ { "name": "prod0", "nodeType": "YulIdentifier", "src": "1384:5:20" } ] }, { "nodeType": "YulAssignment", "src": "1415:43:20", "value": { "arguments": [ { "arguments": [ { "name": "mm", "nodeType": "YulIdentifier", "src": "1432:2:20" }, { "name": "prod0", "nodeType": "YulIdentifier", "src": "1436:5:20" } ], "functionName": { "name": "sub", "nodeType": "YulIdentifier", "src": "1428:3:20" }, "nodeType": "YulFunctionCall", "src": "1428:14:20" }, { "arguments": [ { "name": "mm", "nodeType": "YulIdentifier", "src": "1447:2:20" }, { "name": "prod0", "nodeType": "YulIdentifier", "src": "1451:5:20" } ], "functionName": { "name": "lt", "nodeType": "YulIdentifier", "src": "1444:2:20" }, "nodeType": "YulFunctionCall", "src": "1444:13:20" } ], "functionName": { "name": "sub", "nodeType": "YulIdentifier", "src": "1424:3:20" }, "nodeType": "YulFunctionCall", "src": "1424:34:20" }, "variableNames": [ { "name": "prod1", "nodeType": "YulIdentifier", "src": "1415:5:20" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3823, "isOffset": false, "isSlot": false, "src": "1358:1:20", "valueSize": 1 }, { "declaration": 3823, "isOffset": false, "isSlot": false, "src": "1397:1:20", "valueSize": 1 }, { "declaration": 3825, "isOffset": false, "isSlot": false, "src": "1361:1:20", "valueSize": 1 }, { "declaration": 3825, "isOffset": false, "isSlot": false, "src": "1400:1:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "1384:5:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "1436:5:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "1451:5:20", "valueSize": 1 }, { "declaration": 3836, "isOffset": false, "isSlot": false, "src": "1415:5:20", "valueSize": 1 } ], "id": 3838, "nodeType": "InlineAssembly", "src": "1318:150:20" }, { "condition": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3841, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 3839, "name": "prod1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3836, "src": "1540:5:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "hexValue": "30", "id": 3840, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1549:1:20", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1540:10:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 3852, "nodeType": "IfStatement", "src": "1536:179:20", "trueBody": { "id": 3851, "nodeType": "Block", "src": "1552:163:20", "statements": [ { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3845, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 3843, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3827, "src": "1574:11:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "hexValue": "30", "id": 3844, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1588:1:20", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1574:15:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 3842, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "1566:7:20", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 3846, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1566:24:20", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3847, "nodeType": "ExpressionStatement", "src": "1566:24:20" }, { "AST": { "nodeType": "YulBlock", "src": "1613:65:20", "statements": [ { "nodeType": "YulAssignment", "src": "1631:33:20", "value": { "arguments": [ { "name": "prod0", "nodeType": "YulIdentifier", "src": "1645:5:20" }, { "name": "denominator", "nodeType": "YulIdentifier", "src": "1652:11:20" } ], "functionName": { "name": "div", "nodeType": "YulIdentifier", "src": "1641:3:20" }, "nodeType": "YulFunctionCall", "src": "1641:23:20" }, "variableNames": [ { "name": "result", "nodeType": "YulIdentifier", "src": "1631:6:20" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3827, "isOffset": false, "isSlot": false, "src": "1652:11:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "1645:5:20", "valueSize": 1 }, { "declaration": 3830, "isOffset": false, "isSlot": false, "src": "1631:6:20", "valueSize": 1 } ], "id": 3848, "nodeType": "InlineAssembly", "src": "1604:74:20" }, { "expression": { "id": 3849, "name": "result", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3830, "src": "1698:6:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 3831, "id": 3850, "nodeType": "Return", "src": "1691:13:20" } ] } }, { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3856, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 3854, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3827, "src": "1828:11:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "id": 3855, "name": "prod1", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3836, "src": "1842:5:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1828:19:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 3853, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "1820:7:20", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 3857, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1820:28:20", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3858, "nodeType": "ExpressionStatement", "src": "1820:28:20" }, { "assignments": [ 3860 ], "declarations": [ { "constant": false, "id": 3860, "mutability": "mutable", "name": "remainder", "nodeType": "VariableDeclaration", "scope": 3945, "src": "2125:17:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3859, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2125:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 3861, "nodeType": "VariableDeclarationStatement", "src": "2125:17:20" }, { "AST": { "nodeType": "YulBlock", "src": "2161:62:20", "statements": [ { "nodeType": "YulAssignment", "src": "2175:38:20", "value": { "arguments": [ { "name": "a", "nodeType": "YulIdentifier", "src": "2195:1:20" }, { "name": "b", "nodeType": "YulIdentifier", "src": "2198:1:20" }, { "name": "denominator", "nodeType": "YulIdentifier", "src": "2201:11:20" } ], "functionName": { "name": "mulmod", "nodeType": "YulIdentifier", "src": "2188:6:20" }, "nodeType": "YulFunctionCall", "src": "2188:25:20" }, "variableNames": [ { "name": "remainder", "nodeType": "YulIdentifier", "src": "2175:9:20" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3823, "isOffset": false, "isSlot": false, "src": "2195:1:20", "valueSize": 1 }, { "declaration": 3825, "isOffset": false, "isSlot": false, "src": "2198:1:20", "valueSize": 1 }, { "declaration": 3827, "isOffset": false, "isSlot": false, "src": "2201:11:20", "valueSize": 1 }, { "declaration": 3860, "isOffset": false, "isSlot": false, "src": "2175:9:20", "valueSize": 1 } ], "id": 3862, "nodeType": "InlineAssembly", "src": "2152:71:20" }, { "AST": { "nodeType": "YulBlock", "src": "2296:108:20", "statements": [ { "nodeType": "YulAssignment", "src": "2310:41:20", "value": { "arguments": [ { "name": "prod1", "nodeType": "YulIdentifier", "src": "2323:5:20" }, { "arguments": [ { "name": "remainder", "nodeType": "YulIdentifier", "src": "2333:9:20" }, { "name": "prod0", "nodeType": "YulIdentifier", "src": "2344:5:20" } ], "functionName": { "name": "gt", "nodeType": "YulIdentifier", "src": "2330:2:20" }, "nodeType": "YulFunctionCall", "src": "2330:20:20" } ], "functionName": { "name": "sub", "nodeType": "YulIdentifier", "src": "2319:3:20" }, "nodeType": "YulFunctionCall", "src": "2319:32:20" }, "variableNames": [ { "name": "prod1", "nodeType": "YulIdentifier", "src": "2310:5:20" } ] }, { "nodeType": "YulAssignment", "src": "2364:30:20", "value": { "arguments": [ { "name": "prod0", "nodeType": "YulIdentifier", "src": "2377:5:20" }, { "name": "remainder", "nodeType": "YulIdentifier", "src": "2384:9:20" } ], "functionName": { "name": "sub", "nodeType": "YulIdentifier", "src": "2373:3:20" }, "nodeType": "YulFunctionCall", "src": "2373:21:20" }, "variableNames": [ { "name": "prod0", "nodeType": "YulIdentifier", "src": "2364:5:20" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "2344:5:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "2364:5:20", "valueSize": 1 }, { "declaration": 3833, "isOffset": false, "isSlot": false, "src": "2377:5:20", "valueSize": 1 }, { "declaration": 3836, "isOffset": false, "isSlot": false, "src": "2310:5:20", "valueSize": 1 }, { "declaration": 3836, "isOffset": false, "isSlot": false, "src": "2323:5:20", "valueSize": 1 }, { "declaration": 3860, "isOffset": false, "isSlot": false, "src": "2333:9:20", "valueSize": 1 }, { "declaration": 3860, "isOffset": false, "isSlot": false, "src": "2384:9:20", "valueSize": 1 } ], "id": 3863, "nodeType": "InlineAssembly", "src": "2287:117:20" }, { "assignments": [ 3865 ], "declarations": [ { "constant": false, "id": 3865, "mutability": "mutable", "name": "twos", "nodeType": "VariableDeclaration", "scope": 3945, "src": "2553:12:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3864, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2553:7:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "id": 3870, "initialValue": { "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3869, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 3867, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "2568:12:20", "subExpression": { "id": 3866, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3827, "src": "2569:11:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "&", "rightExpression": { "id": 3868, "name": "denominator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3827, "src": "2583:11:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2568:26:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "2553:41:20" }, { "AST": { "nodeType": "YulBlock", "src": "2659:61:20", "statements": [ { "nodeType": "YulAssignment", "src": "2673:37:20", "value": { "arguments": [ { "name": "denominator", "nodeType": "YulIdentifier", "src": "2692:11:20" }, { "name": "twos", "nodeType": "YulIdentifier", "src": "2705:4:20" } ], "functionName": { "name": "div", "nodeType": "YulIdentifier", "src": "2688:3:20" }, "nodeType": "YulFunctionCall", "src": "2688:22:20" }, "variableNames": [ { "name": "denominator", "nodeType": "YulIdentifier", "src": "2673:11:20" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3827, "isOffset": false, "isSlot": false, "src": "2673:11:20", "valueSize": 1 }, { "declaration": 3827, "isOffset": false, "isSlot": false, "src": "2692:11:20", "valueSize": 1 }, { "declaration": 3865, "isOffset": false, "isSlot": false, "src": "2705:4:20",