UNPKG

hardlydifficult-eth

Version:

A collection of reusable contracts and Javascript helpers for Ethereum.

1,059 lines (1,058 loc) 391 kB
{ "contractName": "SafeMath", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Wrappers over Solidity's arithmetic operations with added overflow checks. Arithmetic operations in Solidity wrap on overflow. This can easily result in bugs, because programmers usually assume that an overflow raises an error, which is the standard behavior in high level programming languages. `SafeMath` restores this intuition by reverting the transaction when an operation overflows. Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/math/SafeMath.sol\":\"SafeMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://526dc85e1f9b9b45830e202568d267d93dde7a4fcccf4ad7798dadcd92304d3c\",\"dweb:/ipfs/QmaoXMB972J3cSDLtBq3xBo4jLwqD2uzXTwujtSPqkYVhR\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212205f8f45509bd389ff1465424e0fdc3cb87b52daef4aebd63f59060cc6387a44f564736f6c634300060a0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212205f8f45509bd389ff1465424e0fdc3cb87b52daef4aebd63f59060cc6387a44f564736f6c634300060a0033", "immutableReferences": {}, "sourceMap": "630:6594:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "630:6594:0:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n", "sourcePath": "@openzeppelin/contracts/math/SafeMath.sol", "ast": { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 354 ] }, "id": 355, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 1, "literals": [ "solidity", ">=", "0.6", ".0", "<", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "33:31:0" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 2, "nodeType": "StructuredDocumentation", "src": "66:563:0", "text": " @dev Wrappers over Solidity's arithmetic operations with added overflow\n checks.\n Arithmetic operations in Solidity wrap on overflow. This can easily result\n in bugs, because programmers usually assume that an overflow raises an\n error, which is the standard behavior in high level programming languages.\n `SafeMath` restores this intuition by reverting the transaction when an\n operation overflows.\n Using this library instead of the unchecked operations eliminates an entire\n class of bugs, so it's recommended to use it always." }, "fullyImplemented": true, "id": 354, "linearizedBaseContracts": [ 354 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 32, "nodeType": "Block", "src": "865:98:0", "statements": [ { "assignments": [ 15 ], "declarations": [ { "constant": false, "id": 15, "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", "overrides": null, "scope": 32, "src": "875:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 14, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "875:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 19, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 18, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 16, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5, "src": "887:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 17, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7, "src": "891:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "887:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "875:17:0" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 22, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 20, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 15, "src": "906:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "id": 21, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 5, "src": "910:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "906:5:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 27, "nodeType": "IfStatement", "src": "902:28:0", "trueBody": { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "hexValue": "66616c7365", "id": 23, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "921:5:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, { "argumentTypes": null, "hexValue": "30", "id": 24, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "928:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "id": 25, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "920:10:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", "typeString": "tuple(bool,int_const 0)" } }, "functionReturnParameters": 13, "id": 26, "nodeType": "Return", "src": "913:17:0" } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "hexValue": "74727565", "id": 28, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "948:4:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, { "argumentTypes": null, "id": 29, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 15, "src": "954:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 30, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "947:9:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", "typeString": "tuple(bool,uint256)" } }, "functionReturnParameters": 13, "id": 31, "nodeType": "Return", "src": "940:16:0" } ] }, "documentation": { "id": 3, "nodeType": "StructuredDocumentation", "src": "653:131:0", "text": " @dev Returns the addition of two unsigned integers, with an overflow flag.\n _Available since v3.4._" }, "id": 33, "implemented": true, "kind": "function", "modifiers": [], "name": "tryAdd", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 8, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5, "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", "overrides": null, "scope": 33, "src": "805:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "805:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7, "mutability": "mutable", "name": "b", "nodeType": "VariableDeclaration", "overrides": null, "scope": 33, "src": "816:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 6, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "816:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "804:22:0" }, "returnParameters": { "id": 13, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 10, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 33, "src": "850:4:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 9, "name": "bool", "nodeType": "ElementaryTypeName", "src": "850:4:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 12, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 33, "src": "856:7:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "856:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "849:15:0" }, "scope": 354, "src": "789:174:0", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 59, "nodeType": "Block", "src": "1185:75:0", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 47, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 45, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1199:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "id": 46, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36, "src": "1203:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1199:5:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 52, "nodeType": "IfStatement", "src": "1195:28:0", "trueBody": { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "hexValue": "66616c7365", "id": 48, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1214:5:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, { "argumentTypes": null, "hexValue": "30", "id": 49, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1221:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "id": 50, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1213:10:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", "typeString": "tuple(bool,int_const 0)" } }, "functionReturnParameters": 44, "id": 51, "nodeType": "Return", "src": "1206:17:0" } }, { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "hexValue": "74727565", "id": 53, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1241:4:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 56, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 54, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 36, "src": "1247:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 55, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38, "src": "1251:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1247:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 57, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1240:13:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", "typeString": "tuple(bool,uint256)" } }, "functionReturnParameters": 44, "id": 58, "nodeType": "Return", "src": "1233:20:0" } ] }, "documentation": { "id": 34, "nodeType": "StructuredDocumentation", "src": "969:135:0", "text": " @dev Returns the substraction of two unsigned integers, with an overflow flag.\n _Available since v3.4._" }, "id": 60, "implemented": true, "kind": "function", "modifiers": [], "name": "trySub", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 39, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 36, "mutability": "mutable", "name": "a", "nodeType": "VariableDeclaration", "overrides": null, "scope": 60, "src": "1125:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 35, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1125:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 38, "mutability": "mutable", "name": "b", "nodeType": "VariableDeclaration", "overrides": null, "scope": 60, "src": "1136:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 37, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1136:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1124:22:0" }, "returnParameters": { "id": 44, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 41, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 60, "src": "1170:4:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 40, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1170:4:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 43, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 60, "src": "1176:7:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 42, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1176:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1169:15:0" }, "scope": 354, "src": "1109:151:0", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 100, "nodeType": "Block", "src": "1484:359:0", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 74, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 72, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 63, "src": "1716:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 73, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1721:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1716:6:0", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 79, "nodeType": "IfStatement", "src": "1712:28:0", "trueBody": { "expression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "hexValue": "74727565", "id": 75, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1732:4:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, { "argumentTypes": null, "hexValue": "30", "id": 76, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1738:1:0", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "id": 77, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1731:9:0", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", "typeString": "tuple(bool,int_const 0)" } }, "functionReturnParameters": 71, "id": 78, "nodeType": "Return", "src": "1724:16:0" } }, { "assignments": [ 81 ], "declarations": [ { "constant": false, "id": 81, "mutability": "mutable", "name": "c", "nodeType": "VariableDeclaration", "overrides": null, "scope": 100, "src": "1750:9:0", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 80, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1750:7:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 85, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 84, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 82, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 63, "src": "1762:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 83, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 65, "src": "1766:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1762:5:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1750:17:0" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 90, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 88, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 86, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 81, "src": "1781:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 87, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 63, "src": "1785:1:0", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }