@gooddollar/goodcontracts
Version:
GoodDollar Contracts
1,079 lines (1,078 loc) • 181 kB
JSON
{
"contractName": "RealMath",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"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\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@daostack/infra/contracts/libs/RealMath.sol\":{\"keccak256\":\"0x3ee79c4b483da327916ac36f9d5cc6a1f2f0363db3ad06793ec67f46e1f653db\",\"urls\":[\"bzz-raw://19b423aa16b93e414c50ca513caabc0f1cb835f31deec82d85d9bb31c0f8d5fb\",\"dweb:/ipfs/QmS8gjtT3jxxoNAosJf6QSStFAE2KZLhNA1Qq9MXwT2CnN\"]}},\"version\":1}",
"bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723158202cf11dd469410d9c368202d205bb618131e6b27384f07f9997f2e6de7662c59064736f6c63430005100032",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723158202cf11dd469410d9c368202d205bb618131e6b27384f07f9997f2e6de7662c59064736f6c63430005100032",
"sourceMap": "390:2427:63:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "390:2427:63:-;;;;;;;;",
"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": [
16577
]
},
"id": 16578,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 16425,
"literals": [
"solidity",
"^",
"0.5",
".4"
],
"nodeType": "PragmaDirective",
"src": "0:23:63"
},
{
"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": 16577,
"linearizedBaseContracts": [
16577
],
"name": "RealMath",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 16428,
"name": "REAL_BITS",
"nodeType": "VariableDeclaration",
"scope": 16577,
"src": "468:40:63",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16426,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "468:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "323536",
"id": 16427,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "505:3:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_256_by_1",
"typeString": "int_const 256"
},
"value": "256"
},
"visibility": "private"
},
{
"constant": true,
"id": 16431,
"name": "REAL_FBITS",
"nodeType": "VariableDeclaration",
"scope": 16577,
"src": "574:40:63",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16429,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "574:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "3430",
"id": 16430,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "612:2:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_40_by_1",
"typeString": "int_const 40"
},
"value": "40"
},
"visibility": "private"
},
{
"constant": true,
"id": 16438,
"name": "REAL_ONE",
"nodeType": "VariableDeclaration",
"scope": 16577,
"src": "680:60:63",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16432,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "680:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16437,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "31",
"id": 16434,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "724:1:63",
"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": 16433,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "716:7:63",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": "uint256"
},
"id": 16435,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "716:10:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<<",
"rightExpression": {
"argumentTypes": null,
"id": 16436,
"name": "REAL_FBITS",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16431,
"src": "730:10:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "716:24:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "private"
},
{
"body": {
"id": 16499,
"nodeType": "Block",
"src": "901:764:63",
"statements": [
{
"assignments": [
16448
],
"declarations": [
{
"constant": false,
"id": 16448,
"name": "tempRealBase",
"nodeType": "VariableDeclaration",
"scope": 16499,
"src": "912:20:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16447,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "912:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 16450,
"initialValue": {
"argumentTypes": null,
"id": 16449,
"name": "realBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16440,
"src": "935:8:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "912:31:63"
},
{
"assignments": [
16452
],
"declarations": [
{
"constant": false,
"id": 16452,
"name": "tempExponent",
"nodeType": "VariableDeclaration",
"scope": 16499,
"src": "953:20:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16451,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "953:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 16454,
"initialValue": {
"argumentTypes": null,
"id": 16453,
"name": "exponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16442,
"src": "976:8:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "953:31:63"
},
{
"assignments": [
16456
],
"declarations": [
{
"constant": false,
"id": 16456,
"name": "realResult",
"nodeType": "VariableDeclaration",
"scope": 16499,
"src": "1031:18:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16455,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1031:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 16458,
"initialValue": {
"argumentTypes": null,
"id": 16457,
"name": "REAL_ONE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16438,
"src": "1052:8:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1031:29:63"
},
{
"body": {
"id": 16495,
"nodeType": "Block",
"src": "1096:499:63",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16467,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16464,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 16462,
"name": "tempExponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16452,
"src": "1161:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "&",
"rightExpression": {
"argumentTypes": null,
"hexValue": "307831",
"id": 16463,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1176:3:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "0x1"
},
"src": "1161:18:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 16465,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "1160:20:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "307831",
"id": 16466,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1184:3:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "0x1"
},
"src": "1160:27:63",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 16476,
"nodeType": "IfStatement",
"src": "1156:192:63",
"trueBody": {
"id": 16475,
"nodeType": "Block",
"src": "1189:159:63",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 16473,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 16468,
"name": "realResult",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16456,
"src": "1291:10:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 16470,
"name": "realResult",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16456,
"src": "1308:10:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 16471,
"name": "tempRealBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16448,
"src": "1320:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 16469,
"name": "mul",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16553,
"src": "1304:3:63",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 16472,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1304:29:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1291:42:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 16474,
"nodeType": "ExpressionStatement",
"src": "1291:42:63"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"id": 16481,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 16477,
"name": "tempExponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16452,
"src": "1402:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16480,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 16478,
"name": "tempExponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16452,
"src": "1417:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">>",
"rightExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 16479,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1433:1:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"src": "1417:17:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1402:32:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 16482,
"nodeType": "ExpressionStatement",
"src": "1402:32:63"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16485,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 16483,
"name": "tempExponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16452,
"src": "1452:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 16484,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1468:1:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1452:17:63",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 16494,
"nodeType": "IfStatement",
"src": "1448:137:63",
"trueBody": {
"id": 16493,
"nodeType": "Block",
"src": "1471:114:63",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 16491,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 16486,
"name": "tempRealBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16448,
"src": "1524:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 16488,
"name": "tempRealBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16448,
"src": "1543:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 16489,
"name": "tempRealBase",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16448,
"src": "1557:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 16487,
"name": "mul",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16553,
"src": "1539:3:63",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 16490,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1539:31:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1524:46:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 16492,
"nodeType": "ExpressionStatement",
"src": "1524:46:63"
}
]
}
}
]
},
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16461,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 16459,
"name": "tempExponent",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16452,
"src": "1077:12:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 16460,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1093:1:63",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1077:17:63",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 16496,
"nodeType": "WhileStatement",
"src": "1070:525:63"
},
{
"expression": {
"argumentTypes": null,
"id": 16497,
"name": "realResult",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16456,
"src": "1648:10:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 16446,
"id": 16498,
"nodeType": "Return",
"src": "1641:17:63"
}
]
},
"documentation": "Raise a real number to any positive integer power",
"id": 16500,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "pow",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 16443,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 16440,
"name": "realBase",
"nodeType": "VariableDeclaration",
"scope": 16500,
"src": "833:16:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16439,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "833:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 16442,
"name": "exponent",
"nodeType": "VariableDeclaration",
"scope": 16500,
"src": "851:16:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16441,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "851:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "832:36:63"
},
"returnParameters": {
"id": 16446,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 16445,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 16500,
"src": "892:7:63",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 16444,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "892:7:63",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "891:9:63"
},
"scope": 16577,
"src": "820:845:63",
"stateMutability": "pure",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 16522,
"nodeType": "Block",
"src": "1824:91:63",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 16514,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 16511,
"name": "numerator",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16502,
"src": "1853:9:63",
"typeDescriptions": {