UNPKG

hardlydifficult-eth

Version:

A collection of reusable contracts and Javascript helpers for Ethereum.

1,164 lines 97.3 kB
{ "contractName": "Sqrt", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Results may be off by 1.\",\"methods\":{},\"stateVariables\":{\"MAX_UINT\":{\"details\":\"The max possible value\"}},\"title\":\"Calculates the square root of a given value.\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/math/Sqrt.sol\":\"Sqrt\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"project:/contracts/math/Sqrt.sol\":{\"keccak256\":\"0x2ad6b44c68238793f920c7ee78b9b4dba44c30734528588faf875499326e0b14\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6f4be8177a8bc12074ba928b783f7dcabe84d6e75632de3a0024849a18d74f52\",\"dweb:/ipfs/QmWK9eicxyqJpUdc9qN23vAv4YdyiAsdVg3Qev9Jxbtcm6\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212206056aeacf43d5c788b30448445de2730512dcd5e4c98c0475511a8b23420457464736f6c634300060a0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212206056aeacf43d5c788b30448445de2730512dcd5e4c98c0475511a8b23420457464736f6c634300060a0033", "immutableReferences": {}, "sourceMap": "154:545:12:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "154:545:12:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.6.0;\n\n\n/**\n * @title Calculates the square root of a given value.\n * @dev Results may be off by 1.\n */\nlibrary Sqrt\n{\n /// @dev The max possible value\n uint256 private constant MAX_UINT = 2**256 - 1;\n\n // Source: https://github.com/ethereum/dapp-bin/pull/50\n function sqrt(\n uint x\n ) internal pure\n returns (uint y)\n {\n if (x == 0)\n {\n return 0;\n }\n else if (x <= 3)\n {\n return 1;\n }\n else if (x == MAX_UINT)\n {\n // Without this we fail on x + 1 below\n return 2**128 - 1;\n }\n\n uint z = (x + 1) / 2;\n y = x;\n while (z < y)\n {\n y = z;\n z = (x / z + z) / 2;\n }\n }\n}", "sourcePath": "/home/circleci/repo/contracts/math/Sqrt.sol", "ast": { "absolutePath": "project:/contracts/math/Sqrt.sol", "exportedSymbols": { "Sqrt": [ 2867 ] }, "id": 2868, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 2791, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "32:23:12" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 2792, "nodeType": "StructuredDocumentation", "src": "58:95:12", "text": " @title Calculates the square root of a given value.\n @dev Results may be off by 1." }, "fullyImplemented": true, "id": 2867, "linearizedBaseContracts": [ 2867 ], "name": "Sqrt", "nodeType": "ContractDefinition", "nodes": [ { "constant": true, "documentation": { "id": 2793, "nodeType": "StructuredDocumentation", "src": "171:31:12", "text": "@dev The max possible value" }, "id": 2800, "mutability": "constant", "name": "MAX_UINT", "nodeType": "VariableDeclaration", "overrides": null, "scope": 2867, "src": "205:46:12", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2794, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "205:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1", "typeString": "int_const 1157...(70 digits omitted)...9935" }, "id": 2799, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639936_by_1", "typeString": "int_const 1157...(70 digits omitted)...9936" }, "id": 2797, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "32", "id": 2795, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "241:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "hexValue": "323536", "id": 2796, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "244:3:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_256_by_1", "typeString": "int_const 256" }, "value": "256" }, "src": "241:6:12", "typeDescriptions": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639936_by_1", "typeString": "int_const 1157...(70 digits omitted)...9936" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 2798, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "250:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "241:10:12", "typeDescriptions": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1", "typeString": "int_const 1157...(70 digits omitted)...9935" } }, "visibility": "private" }, { "body": { "id": 2865, "nodeType": "Block", "src": "381:316:12", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2809, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2807, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "391:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 2808, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "396:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "391:6:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2815, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2813, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "440:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "hexValue": "33", "id": 2814, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "445:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_3_by_1", "typeString": "int_const 3" }, "value": "3" }, "src": "440:6:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2821, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2819, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "489:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 2820, "name": "MAX_UINT", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2800, "src": "494:8:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "489:13:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 2829, "nodeType": "IfStatement", "src": "485:100:12", "trueBody": { "id": 2828, "nodeType": "Block", "src": "508:77:12", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", "typeString": "int_const 3402...(31 digits omitted)...1455" }, "id": 2826, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", "typeString": "int_const 3402...(31 digits omitted)...1456" }, "id": 2824, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "32", "id": 2822, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "568:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "hexValue": "313238", "id": 2823, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "571:3:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_128_by_1", "typeString": "int_const 128" }, "value": "128" }, "src": "568:6:12", "typeDescriptions": { "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", "typeString": "int_const 3402...(31 digits omitted)...1456" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 2825, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "577:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "568:10:12", "typeDescriptions": { "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", "typeString": "int_const 3402...(31 digits omitted)...1455" } }, "functionReturnParameters": 2806, "id": 2827, "nodeType": "Return", "src": "561:17:12" } ] } }, "id": 2830, "nodeType": "IfStatement", "src": "436:149:12", "trueBody": { "id": 2818, "nodeType": "Block", "src": "452:23:12", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "31", "id": 2816, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "467:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "functionReturnParameters": 2806, "id": 2817, "nodeType": "Return", "src": "460:8:12" } ] } }, "id": 2831, "nodeType": "IfStatement", "src": "387:198:12", "trueBody": { "id": 2812, "nodeType": "Block", "src": "403:23:12", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 2810, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "418:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 2806, "id": 2811, "nodeType": "Return", "src": "411:8:12" } ] } }, { "assignments": [ 2833 ], "declarations": [ { "constant": false, "id": 2833, "mutability": "mutable", "name": "z", "nodeType": "VariableDeclaration", "overrides": null, "scope": 2865, "src": "591:6:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2832, "name": "uint", "nodeType": "ElementaryTypeName", "src": "591:4:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 2840, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2839, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2836, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2834, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "601:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "hexValue": "31", "id": 2835, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "605:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_1_by_1", "typeString": "int_const 1" }, "value": "1" }, "src": "601:5:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 2837, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "600:7:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "hexValue": "32", "id": 2838, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "610:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "src": "600:11:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "591:20:12" }, { "expression": { "argumentTypes": null, "id": 2843, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2841, "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2805, "src": "617:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2842, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "621:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "617:5:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2844, "nodeType": "ExpressionStatement", "src": "617:5:12" }, { "body": { "id": 2863, "nodeType": "Block", "src": "646:47:12", "statements": [ { "expression": { "argumentTypes": null, "id": 2850, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2848, "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2805, "src": "654:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2849, "name": "z", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2833, "src": "658:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "654:5:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2851, "nodeType": "ExpressionStatement", "src": "654:5:12" }, { "expression": { "argumentTypes": null, "id": 2861, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2852, "name": "z", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2833, "src": "667:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2860, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2857, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2855, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2853, "name": "x", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2802, "src": "672:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 2854, "name": "z", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2833, "src": "676:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "672:5:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 2856, "name": "z", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2833, "src": "680:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "672:9:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 2858, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "671:11:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "hexValue": "32", "id": 2859, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "685:1:12", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "src": "671:15:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "667:19:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2862, "nodeType": "ExpressionStatement", "src": "667:19:12" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 2847, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 2845, "name": "z", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2833, "src": "635:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 2846, "name": "y", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2805, "src": "639:1:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "635:5:12", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 2864, "nodeType": "WhileStatement", "src": "628:65:12" } ] }, "documentation": null, "id": 2866, "implemented": true, "kind": "function", "modifiers": [], "name": "sqrt", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 2803, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2802, "mutability": "mutable", "name": "x", "nodeType": "VariableDeclaration", "overrides": null, "scope": 2866, "src": "333:6:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2801, "name": "uint", "nodeType": "ElementaryTypeName", "src": "333:4:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "327:16:12" }, "returnParameters": { "id": 2806, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2805, "mutability": "mutable", "name": "y", "nodeType": "VariableDeclaration", "overrides": null, "scope": 2866, "src": "371:6:12", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2804, "name": "uint", "nodeType": "ElementaryTypeName", "src": "371:4:12", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "370:8:12" }, "scope": 2867, "src": "314:383:12", "stateMutability": "pure", "virtual": false, "visibility": "internal" } ], "scope": 2868, "src": "154:545:12" } ], "src": "32:667:12" }, "legacyAST": { "attributes": { "absolutePath": "project:/contracts/math/Sqrt.sol", "exportedSymbols": { "Sqrt": [ 2867 ] }, "license": "MIT" }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.6", ".0" ] }, "id": 2791, "name": "PragmaDirective", "src": "32:23:12" }, { "attributes": { "abstract": false, "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "library", "fullyImplemented": true, "linearizedBaseContracts": [ 2867 ], "name": "Sqrt", "scope": 2868 }, "children": [ { "attributes": { "text": " @title Calculates the square root of a given value.\n @dev Results may be off by 1." }, "id": 2792, "name": "StructuredDocumentation", "src": "58:95:12" }, { "attributes": { "constant": true, "mutability": "constant", "name": "MAX_UINT", "overrides": null, "scope": 2867, "stateVariable": true, "storageLocation": "default", "type": "uint256", "visibility": "private" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2794, "name": "ElementaryTypeName", "src": "205:7:12" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1", "typeString": "int_const 1157...(70 digits omitted)...9935" }, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "operator": "-", "type": "int_const 1157...(70 digits omitted)...9935" }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639936_by_1", "typeString": "int_const 1157...(70 digits omitted)...9936" }, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "operator": "**", "type": "int_const 1157...(70 digits omitted)...9936" }, "children": [ { "attributes": { "argumentT