UNPKG

@sonicswap/periphery

Version:

🎚 Peripheral smart contracts for interacting with the Sonicswap exchanges

1,171 lines (1,170 loc) • 267 kB
{ "contractName": "FullMath", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@sonicswap/lib/contracts/libraries/FullMath.sol\":\"FullMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@sonicswap/lib/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0x074f43cf798f046118ed21bb9859a7fa1074b9581fe315c8702d6d292fdb2784\",\"license\":\"CC-BY-4.0\",\"urls\":[\"bzz-raw://55a5cb6c5ae9ccc1e6870315bfa5f23f4c758db606f6a292fdff2224fcec082e\",\"dweb:/ipfs/QmRZayK4DWdWHaape9XcVj6VobzX7en7Tejk7gbzv7CHTy\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220af0c56ebc3952ec18877c442f123a3dfc15ada19ff836b378d6cf4cc9fbe10c164736f6c634300060c0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220af0c56ebc3952ec18877c442f123a3dfc15ada19ff836b378d6cf4cc9fbe10c164736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "193:1079:29:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "193:1079:29:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: CC-BY-4.0\npragma solidity =0.6.12;\n\n// taken from https://medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1\n// license is CC-BY-4.0\nlibrary FullMath {\n function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) {\n uint256 mm = mulmod(x, y, uint256(-1));\n l = x * y;\n h = mm - l;\n if (mm < l) h -= 1;\n }\n\n function fullDiv(\n uint256 l,\n uint256 h,\n uint256 d\n ) private pure returns (uint256) {\n uint256 pow2 = d & -d;\n d /= pow2;\n l /= pow2;\n l += h * ((-pow2) / pow2 + 1);\n uint256 r = 1;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n r *= 2 - d * r;\n return l * r;\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 d\n ) internal pure returns (uint256) {\n (uint256 l, uint256 h) = fullMul(x, y);\n\n uint256 mm = mulmod(x, y, d);\n if (mm > l) h -= 1;\n l -= mm;\n\n if (h == 0) return l / d;\n\n require(h < d, 'FullMath: FULLDIV_OVERFLOW');\n return fullDiv(l, h, d);\n }\n}\n", "sourcePath": "@sonicswap/lib/contracts/libraries/FullMath.sol", "ast": { "absolutePath": "@sonicswap/lib/contracts/libraries/FullMath.sol", "exportedSymbols": { "FullMath": [ 9684 ] }, "id": 9685, "license": "CC-BY-4.0", "nodeType": "SourceUnit", "nodes": [ { "id": 9465, "literals": [ "solidity", "=", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "38:24:29" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 9684, "linearizedBaseContracts": [ 9684 ], "name": "FullMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 9508, "nodeType": "Block", "src": "300:122:29", "statements": [ { "assignments": [ 9477 ], "declarations": [ { "constant": false, "id": 9477, "mutability": "mutable", "name": "mm", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9508, "src": "310:10:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9476, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "310:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 9487, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 9479, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9467, "src": "330:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 9480, "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9469, "src": "333:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 9484, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "344:2:29", "subExpression": { "argumentTypes": null, "hexValue": "31", "id": 9483, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "345:1:29", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "typeDescriptions": { "typeIdentifier": "t_rational_minus_1_by_1", "typeString": "int_const -1" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_minus_1_by_1", "typeString": "int_const -1" } ], "id": 9482, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "336:7:29", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": { "id": 9481, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "336:7:29", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 9485, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "336:11:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 9478, "name": "mulmod", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -16, "src": "323:6:29", "typeDescriptions": { "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" } }, "id": 9486, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "323:25:29", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "310:38:29" }, { "expression": { "argumentTypes": null, "id": 9492, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9488, "name": "l", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9472, "src": "358:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9491, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9489, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9467, "src": "362:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 9490, "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9469, "src": "366:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "362:5:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "358:9:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9493, "nodeType": "ExpressionStatement", "src": "358:9:29" }, { "expression": { "argumentTypes": null, "id": 9498, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9494, "name": "h", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9474, "src": "377:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9497, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9495, "name": "mm", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9477, "src": "381:2:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 9496, "name": "l", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9472, "src": "386:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "381:6:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "377:10:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9499, "nodeType": "ExpressionStatement", "src": "377:10:29" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9502, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9500, "name": "mm", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9477, "src": "401:2:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 9501, "name": "l", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9472, "src": "406:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "401:6:29", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 9507, "nodeType": "IfStatement", "src": "397:18:29", "trueBody": { "expression": { "argumentTypes": null, "id": 9505, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9503, "name": "h", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9474, "src": "409:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "-=", "rightHandSide": { "argumentTypes": null, "hexValue": "31", "id": 9504, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "414:1:29", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "409:6:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9506, "nodeType": "ExpressionStatement", "src": "409:6:29" } } ] }, "documentation": null, "id": 9509, "implemented": true, "kind": "function", "modifiers": [], "name": "fullMul", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 9470, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9467, "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9509, "src": "233:9:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9466, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "233:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9469, "mutability": "mutable", "name": "y", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9509, "src": "244:9:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9468, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "244:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "232:22:29" }, "returnParameters": { "id": 9475, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9472, "mutability": "mutable", "name": "l", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9509, "src": "278:9:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9471, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "278:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9474, "mutability": "mutable", "name": "h", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9509, "src": "289:9:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9473, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "289:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "277:22:29" }, "scope": 9684, "src": "216:206:29", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 9620, "nodeType": "Block", "src": "539:352:29", "statements": [ { "assignments": [ 9521 ], "declarations": [ { "constant": false, "id": 9521, "mutability": "mutable", "name": "pow2", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9620, "src": "549:12:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9520, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "549:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 9526, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9525, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9522, "name": "d", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9515, "src": "564:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "&", "rightExpression": { "argumentTypes": null, "id": 9524, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "568:2:29", "subExpression": { "argumentTypes": null, "id": 9523, "name": "d", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9515, "src": "569:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "564:6:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "549:21:29" }, { "expression": { "argumentTypes": null, "id": 9529, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9527, "name": "d", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9515, "src": "580:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "/=", "rightHandSide": { "argumentTypes": null, "id": 9528, "name": "pow2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9521, "src": "585:4:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "580:9:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9530, "nodeType": "ExpressionStatement", "src": "580:9:29" }, { "expression": { "argumentTypes": null, "id": 9533, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9531, "name": "l", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9511, "src": "599:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "/=", "rightHandSide": { "argumentTypes": null, "id": 9532, "name": "pow2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9521, "src": "604:4:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "599:9:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9534, "nodeType": "ExpressionStatement", "src": "599:9:29" }, { "expression": { "argumentTypes": null, "id": 9546, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9535, "name": "l", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9511, "src": "618:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "+=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9545, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9536, "name": "h", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9513, "src": "623:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9543, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9541, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "id": 9538, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "-", "prefix": true, "src": "629:5:29", "subExpression": { "argumentTypes": null, "id": 9537, "name": "pow2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9521, "src": "630:4:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 9539, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "628:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 9540, "name": "pow2", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9521, "src": "638:4:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "628:14:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 9542, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "645:1:29", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "628:18:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 9544, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "627:20:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "623:24:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "618:29:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 9547, "nodeType": "ExpressionStatement", "src": "618:29:29" }, { "assignments": [ 9549 ], "declarations": [ { "constant": false, "id": 9549, "mutability": "mutable", "name": "r", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9620, "src": "657:9:29", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 9548, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "657:7:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 9551, "initialValue": { "argumentTypes": null, "hexValue": "31", "id": 9550, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "669:1:29", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "nodeType": "VariableDeclarationStatement", "src": "657:13:29" }, { "expression": { "argumentTypes": null, "id": 9558, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9552, "name": "r", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9549, "src": "680:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "*=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9557, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "32", "id": 9553, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "685:1:29", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 9556, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 9554, "name": "d", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9515, "src": "689:1:29", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256"