hardlydifficult-eth
Version:
A collection of reusable contracts and Javascript helpers for Ethereum.
1,176 lines (1,175 loc) • 257 kB
JSON
{
"contractName": "FullMath",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@uniswap/lib/contracts/libraries/FullMath.sol\":\"FullMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"@uniswap/lib/contracts/libraries/FullMath.sol\":{\"keccak256\":\"0xf3dd7fc13a7eee86c17cdfe13b03a7f24ebaf09588550b64b581ae7b2bd59273\",\"license\":\"CC-BY-4.0\",\"urls\":[\"bzz-raw://492ced3afa929c790c9b1314b86454a977528e8f3d408a55b1275a396154d097\",\"dweb:/ipfs/QmbX2YAgtoM13Z2MRnV5WnUpzmw3fMxmhzCnsKKxQUjGJJ\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220b21b41adc6f8d840b84d804b8895dda84e405d27c7890c8ddb2719b337c77b4d64736f6c634300060a0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220b21b41adc6f8d840b84d804b8895dda84e405d27c7890c8ddb2719b337c77b4d64736f6c634300060a0033",
"immutableReferences": {},
"sourceMap": "193:1041:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "193:1041:5:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: CC-BY-4.0\npragma solidity >=0.4.0;\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) private 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 uint256 mm = mulmod(x, y, d);\n if (mm > l) h -= 1;\n l -= mm;\n require(h < d, 'FullMath: FULLDIV_OVERFLOW');\n return fullDiv(l, h, d);\n }\n}\n",
"sourcePath": "@uniswap/lib/contracts/libraries/FullMath.sol",
"ast": {
"absolutePath": "@uniswap/lib/contracts/libraries/FullMath.sol",
"exportedSymbols": {
"FullMath": [
1379
]
},
"id": 1380,
"license": "CC-BY-4.0",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1168,
"literals": [
"solidity",
">=",
"0.4",
".0"
],
"nodeType": "PragmaDirective",
"src": "38:24:5"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 1379,
"linearizedBaseContracts": [
1379
],
"name": "FullMath",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 1211,
"nodeType": "Block",
"src": "299:122:5",
"statements": [
{
"assignments": [
1180
],
"declarations": [
{
"constant": false,
"id": 1180,
"mutability": "mutable",
"name": "mm",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1211,
"src": "309:10:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1179,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "309:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 1190,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1182,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1170,
"src": "329:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 1183,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1172,
"src": "332:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1187,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "343:2:5",
"subExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 1186,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "344:1:5",
"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": 1185,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "335:7:5",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": {
"id": 1184,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "335:7:5",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
}
},
"id": 1188,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "335:11:5",
"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": 1181,
"name": "mulmod",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -16,
"src": "322:6:5",
"typeDescriptions": {
"typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256,uint256) pure returns (uint256)"
}
},
"id": 1189,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "322:25:5",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "309:38:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1195,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1191,
"name": "l",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1175,
"src": "357:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1194,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1192,
"name": "x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1170,
"src": "361:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 1193,
"name": "y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1172,
"src": "365:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "361:5:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "357:9:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1196,
"nodeType": "ExpressionStatement",
"src": "357:9:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1201,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1197,
"name": "h",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1177,
"src": "376:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1200,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1198,
"name": "mm",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1180,
"src": "380:2:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 1199,
"name": "l",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1175,
"src": "385:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "380:6:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "376:10:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1202,
"nodeType": "ExpressionStatement",
"src": "376:10:5"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1205,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1203,
"name": "mm",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1180,
"src": "400:2:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 1204,
"name": "l",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1175,
"src": "405:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "400:6:5",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 1210,
"nodeType": "IfStatement",
"src": "396:18:5",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 1208,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1206,
"name": "h",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1177,
"src": "408:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "-=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "31",
"id": 1207,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "413:1:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "408:6:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1209,
"nodeType": "ExpressionStatement",
"src": "408:6:5"
}
}
]
},
"documentation": null,
"id": 1212,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "fullMul",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 1173,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1170,
"mutability": "mutable",
"name": "x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1212,
"src": "233:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1169,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "233:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1172,
"mutability": "mutable",
"name": "y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1212,
"src": "244:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1171,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "244:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "232:22:5"
},
"returnParameters": {
"id": 1178,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1175,
"mutability": "mutable",
"name": "l",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1212,
"src": "277:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1174,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "277:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1177,
"mutability": "mutable",
"name": "h",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1212,
"src": "288:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1176,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "288:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "276:22:5"
},
"scope": 1379,
"src": "216:205:5",
"stateMutability": "pure",
"virtual": false,
"visibility": "private"
},
{
"body": {
"id": 1323,
"nodeType": "Block",
"src": "538:352:5",
"statements": [
{
"assignments": [
1224
],
"declarations": [
{
"constant": false,
"id": 1224,
"mutability": "mutable",
"name": "pow2",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1323,
"src": "548:12:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1223,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "548:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 1229,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1228,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1225,
"name": "d",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1218,
"src": "563:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "&",
"rightExpression": {
"argumentTypes": null,
"id": 1227,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "567:2:5",
"subExpression": {
"argumentTypes": null,
"id": 1226,
"name": "d",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1218,
"src": "568:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "563:6:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "548:21:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1232,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1230,
"name": "d",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1218,
"src": "579:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "/=",
"rightHandSide": {
"argumentTypes": null,
"id": 1231,
"name": "pow2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1224,
"src": "584:4:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "579:9:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1233,
"nodeType": "ExpressionStatement",
"src": "579:9:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1236,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1234,
"name": "l",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1214,
"src": "598:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "/=",
"rightHandSide": {
"argumentTypes": null,
"id": 1235,
"name": "pow2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1224,
"src": "603:4:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "598:9:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1237,
"nodeType": "ExpressionStatement",
"src": "598:9:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1249,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1238,
"name": "l",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1214,
"src": "617:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1248,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1239,
"name": "h",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1216,
"src": "622:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1246,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1244,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 1241,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "628:5:5",
"subExpression": {
"argumentTypes": null,
"id": 1240,
"name": "pow2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1224,
"src": "629:4:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 1242,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "627:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 1243,
"name": "pow2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1224,
"src": "637:4:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "627:14:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 1245,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "644:1:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "627:18:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 1247,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "626:20:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "622:24:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "617:29:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1250,
"nodeType": "ExpressionStatement",
"src": "617:29:5"
},
{
"assignments": [
1252
],
"declarations": [
{
"constant": false,
"id": 1252,
"mutability": "mutable",
"name": "r",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 1323,
"src": "656:9:5",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1251,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "656:7:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 1254,
"initialValue": {
"argumentTypes": null,
"hexValue": "31",
"id": 1253,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "668:1:5",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"nodeType": "VariableDeclarationStatement",
"src": "656:13:5"
},
{
"expression": {
"argumentTypes": null,
"id": 1261,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1255,
"name": "r",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1252,
"src": "679:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "*=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 1260,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "32",
"id": 1256,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "684:1:5",
"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": 1259,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1257,
"name": "d",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1218,
"src": "688:1:5",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {