UNPKG

@gooddollar/goodcontracts

Version:
1,080 lines (1,079 loc) 181 kB
{ "contractName": "RealMath", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.4+commit.9549d8ff\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{},\"notice\":\"RealMath: fixed-point math library, based on fractional and integer parts. Using uint256 as real216x40, which isn't in Solidity yet. Internally uses the wider uint256 for some math. * Note that for addition, subtraction, and mod (%), you should just use the built-in Solidity operators. Functions for these operations are not provided. \"}},\"settings\":{\"compilationTarget\":{\"@daostack/infra/contracts/libs/RealMath.sol\":\"RealMath\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@daostack/infra/contracts/libs/RealMath.sol\":{\"keccak256\":\"0x3ee79c4b483da327916ac36f9d5cc6a1f2f0363db3ad06793ec67f46e1f653db\",\"urls\":[\"bzzr://548cdb33afa45d2d4bfb0ed3f557257f77c7d9ae142326d04584e20d00c153d3\"]}},\"version\":1}", "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a7230582094f0cec0a756631b9816891442bb08bf11a0fd961322fe80a2312c60995f01bd0029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a7230582094f0cec0a756631b9816891442bb08bf11a0fd961322fe80a2312c60995f01bd0029", "sourceMap": "390:2427:54:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24", "deployedSourceMap": "390:2427:54:-;;;;;;;;", "source": "pragma solidity ^0.5.4;\n\n/**\n * RealMath: fixed-point math library, based on fractional and integer parts.\n * Using uint256 as real216x40, which isn't in Solidity yet.\n * Internally uses the wider uint256 for some math.\n *\n * Note that for addition, subtraction, and mod (%), you should just use the\n * built-in Solidity operators. Functions for these operations are not provided.\n *\n */\n\n\nlibrary RealMath {\n\n /**\n * How many total bits are there?\n */\n uint256 constant private REAL_BITS = 256;\n\n /**\n * How many fractional bits are there?\n */\n uint256 constant private REAL_FBITS = 40;\n\n /**\n * What's the first non-fractional bit\n */\n uint256 constant private REAL_ONE = uint256(1) << REAL_FBITS;\n\n /**\n * Raise a real number to any positive integer power\n */\n function pow(uint256 realBase, uint256 exponent) internal pure returns (uint256) {\n\n uint256 tempRealBase = realBase;\n uint256 tempExponent = exponent;\n\n // Start with the 0th power\n uint256 realResult = REAL_ONE;\n while (tempExponent != 0) {\n // While there are still bits set\n if ((tempExponent & 0x1) == 0x1) {\n // If the low bit is set, multiply in the (many-times-squared) base\n realResult = mul(realResult, tempRealBase);\n }\n // Shift off the low bit\n tempExponent = tempExponent >> 1;\n if (tempExponent != 0) {\n // Do the squaring\n tempRealBase = mul(tempRealBase, tempRealBase);\n }\n }\n\n // Return the final result.\n return realResult;\n }\n\n /**\n * Create a real from a rational fraction.\n */\n function fraction(uint216 numerator, uint216 denominator) internal pure returns (uint256) {\n return div(uint256(numerator) * REAL_ONE, uint256(denominator) * REAL_ONE);\n }\n\n /**\n * Multiply one real by another. Truncates overflows.\n */\n function mul(uint256 realA, uint256 realB) private pure returns (uint256) {\n // When multiplying fixed point in x.y and z.w formats we get (x+z).(y+w) format.\n // So we just have to clip off the extra REAL_FBITS fractional bits.\n uint256 res = realA * realB;\n require(res/realA == realB, \"RealMath mul overflow\");\n return (res >> REAL_FBITS);\n }\n\n /**\n * Divide one real by another real. Truncates overflows.\n */\n function div(uint256 realNumerator, uint256 realDenominator) private pure returns (uint256) {\n // We use the reverse of the multiplication trick: convert numerator from\n // x.y to (x+z).(y+w) fixed point, then divide by denom in z.w fixed point.\n return uint256((uint256(realNumerator) * REAL_ONE) / uint256(realDenominator));\n }\n\n}\n", "sourcePath": "@daostack/infra/contracts/libs/RealMath.sol", "ast": { "absolutePath": "@daostack/infra/contracts/libs/RealMath.sol", "exportedSymbols": { "RealMath": [ 11188 ] }, "id": 11189, "nodeType": "SourceUnit", "nodes": [ { "id": 11036, "literals": [ "solidity", "^", "0.5", ".4" ], "nodeType": "PragmaDirective", "src": "0:23:54" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "RealMath: fixed-point math library, based on fractional and integer parts.\nUsing uint256 as real216x40, which isn't in Solidity yet.\nInternally uses the wider uint256 for some math.\n * Note that for addition, subtraction, and mod (%), you should just use the\nbuilt-in Solidity operators. Functions for these operations are not provided.\n ", "fullyImplemented": true, "id": 11188, "linearizedBaseContracts": [ 11188 ], "name": "RealMath", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "id": 11039, "name": "REAL_BITS", "nodeType": "VariableDeclaration", "scope": 11188, "src": "468:40:54", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11037, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "468:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "323536", "id": 11038, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "505:3:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_256_by_1", "typeString": "int_const 256" }, "value": "256" }, "visibility": "private" }, { "constant": true, "id": 11042, "name": "REAL_FBITS", "nodeType": "VariableDeclaration", "scope": 11188, "src": "574:40:54", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11040, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "574:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "hexValue": "3430", "id": 11041, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "612:2:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_40_by_1", "typeString": "int_const 40" }, "value": "40" }, "visibility": "private" }, { "constant": true, "id": 11049, "name": "REAL_ONE", "nodeType": "VariableDeclaration", "scope": 11188, "src": "680:60:54", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11043, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "680:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11048, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "31", "id": 11045, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "724:1:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" } ], "id": 11044, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "716:7:54", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint256_$", "typeString": "type(uint256)" }, "typeName": "uint256" }, "id": 11046, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "716:10:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<<", "rightExpression": { "argumentTypes": null, "id": 11047, "name": "REAL_FBITS", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11042, "src": "730:10:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "716:24:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "private" }, { "body": { "id": 11110, "nodeType": "Block", "src": "901:764:54", "statements": [ { "assignments": [ 11059 ], "declarations": [ { "constant": false, "id": 11059, "name": "tempRealBase", "nodeType": "VariableDeclaration", "scope": 11110, "src": "912:20:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11058, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "912:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 11061, "initialValue": { "argumentTypes": null, "id": 11060, "name": "realBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11051, "src": "935:8:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "912:31:54" }, { "assignments": [ 11063 ], "declarations": [ { "constant": false, "id": 11063, "name": "tempExponent", "nodeType": "VariableDeclaration", "scope": 11110, "src": "953:20:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11062, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "953:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 11065, "initialValue": { "argumentTypes": null, "id": 11064, "name": "exponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11053, "src": "976:8:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "953:31:54" }, { "assignments": [ 11067 ], "declarations": [ { "constant": false, "id": 11067, "name": "realResult", "nodeType": "VariableDeclaration", "scope": 11110, "src": "1031:18:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11066, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1031:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 11069, "initialValue": { "argumentTypes": null, "id": 11068, "name": "REAL_ONE", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11049, "src": "1052:8:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1031:29:54" }, { "body": { "id": 11106, "nodeType": "Block", "src": "1096:499:54", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11078, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11075, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11073, "name": "tempExponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11063, "src": "1161:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "&", "rightExpression": { "argumentTypes": null, "hexValue": "307831", "id": 11074, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1176:3:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "0x1" }, "src": "1161:18:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 11076, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1160:20:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "307831", "id": 11077, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1184:3:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "0x1" }, "src": "1160:27:54", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 11087, "nodeType": "IfStatement", "src": "1156:192:54", "trueBody": { "id": 11086, "nodeType": "Block", "src": "1189:159:54", "statements": [ { "expression": { "argumentTypes": null, "id": 11084, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11079, "name": "realResult", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11067, "src": "1291:10:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11081, "name": "realResult", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11067, "src": "1308:10:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 11082, "name": "tempRealBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11059, "src": "1320:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 11080, "name": "mul", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11164, "src": "1304:3:54", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 11083, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1304:29:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1291:42:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 11085, "nodeType": "ExpressionStatement", "src": "1291:42:54" } ] } }, { "expression": { "argumentTypes": null, "id": 11092, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11088, "name": "tempExponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11063, "src": "1402:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11091, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11089, "name": "tempExponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11063, "src": "1417:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">>", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 11090, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1433:1:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "1417:17:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1402:32:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 11093, "nodeType": "ExpressionStatement", "src": "1402:32:54" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11096, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11094, "name": "tempExponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11063, "src": "1452:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 11095, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1468:1:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1452:17:54", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 11105, "nodeType": "IfStatement", "src": "1448:137:54", "trueBody": { "id": 11104, "nodeType": "Block", "src": "1471:114:54", "statements": [ { "expression": { "argumentTypes": null, "id": 11102, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11097, "name": "tempRealBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11059, "src": "1524:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11099, "name": "tempRealBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11059, "src": "1543:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "argumentTypes": null, "id": 11100, "name": "tempRealBase", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11059, "src": "1557:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 11098, "name": "mul", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11164, "src": "1539:3:54", "typeDescriptions": { "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", "typeString": "function (uint256,uint256) pure returns (uint256)" } }, "id": 11101, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1539:31:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1524:46:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 11103, "nodeType": "ExpressionStatement", "src": "1524:46:54" } ] } } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11072, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 11070, "name": "tempExponent", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11063, "src": "1077:12:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 11071, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1093:1:54", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1077:17:54", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 11107, "nodeType": "WhileStatement", "src": "1070:525:54" }, { "expression": { "argumentTypes": null, "id": 11108, "name": "realResult", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11067, "src": "1648:10:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 11057, "id": 11109, "nodeType": "Return", "src": "1641:17:54" } ] }, "documentation": "Raise a real number to any positive integer power", "id": 11111, "implemented": true, "kind": "function", "modifiers": [], "name": "pow", "nodeType": "FunctionDefinition", "parameters": { "id": 11054, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11051, "name": "realBase", "nodeType": "VariableDeclaration", "scope": 11111, "src": "833:16:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11050, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "833:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 11053, "name": "exponent", "nodeType": "VariableDeclaration", "scope": 11111, "src": "851:16:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11052, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "851:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "832:36:54" }, "returnParameters": { "id": 11057, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11056, "name": "", "nodeType": "VariableDeclaration", "scope": 11111, "src": "892:7:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11055, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "892:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "891:9:54" }, "scope": 11188, "src": "820:845:54", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 11133, "nodeType": "Block", "src": "1824:91:54", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 11125, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11122, "name": "numerator", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11113, "src": "1853:9:54", "typeDescriptions": { "typeIdentifier": "t_uint216",