{ "contractName": "SafeMath", "abi": [], "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820c21a701330b3213d7b0bf7bea9117168fc0c0242e1a94a0b0d94b0ea3ce1cf9e0029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820c21a701330b3213d7b0bf7bea9117168fc0c0242e1a94a0b0d94b0ea3ce1cf9e0029", "sourceMap": "117:1016:8:-;;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": "117:1016:8:-;;;;;;;;", "source": "pragma solidity ^0.4.21;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {\n if (a == 0) {\n return 0;\n }\n c = a * b;\n assert(c / a == b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // assert(b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n return a / b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n assert(b <= a);\n return a - b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256 c) {\n c = a + b;\n assert(c >= a);\n return c;\n }\n}\n", "sourcePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/math/SafeMath.sol", "ast": { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 579 ] }, "id": 580, "nodeType": "SourceUnit", "nodes": [ { "id": 487, "literals": [ "solidity", "^", "0.4", ".21" ], "nodeType": "PragmaDirective", "src": "0:24:8" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error", "fullyImplemented": true, "id": 579, "linearizedBaseContracts": [ 579 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 519, "nodeType": "Block", "src": "272:98:8", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 498, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 496, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "282:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 497, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "287:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "282:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 502, "nodeType": "IfStatement", "src": "278:35:8", "trueBody": { "id": 501, "nodeType": "Block", "src": "290:23:8", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 499, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "305:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 495, "id": 500, "nodeType": "Return", "src": "298:8:8" } ] } }, { "expression": { "argumentTypes": null, "id": 507, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 503, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "318:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 506, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 504, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "322:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 505, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 491, "src": "326:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "322:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "318:9:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 508, "nodeType": "ExpressionStatement", "src": "318:9:8" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 514, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 512, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 510, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "340:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 511, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "344:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "340:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 513, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 491, "src": "349:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "340:10:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 509, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "333:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 515, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "333:18:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 516, "nodeType": "ExpressionStatement", "src": "333:18:8" }, { "expression": { "argumentTypes": null, "id": 517, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "364:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 495, "id": 518, "nodeType": "Return", "src": "357:8:8" } ] }, "documentation": "@dev Multiplies two numbers, throws on overflow.", "id": 520, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "mul", "nodeType": "FunctionDefinition", "parameters": { "id": 492, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 489, "name": "a", "nodeType": "VariableDeclaration", "scope": 520, "src": "216:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 488, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "216:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 491, "name": "b", "nodeType": "VariableDeclaration", "scope": 520, "src": "227:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 490, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "227:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "215:22:8" }, "payable": false, "returnParameters": { "id": 495, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 494, "name": "c", "nodeType": "VariableDeclaration", "scope": 520, "src": "261:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 493, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "261:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "260:11:8" }, "scope": 579, "src": "203:167:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 533, "nodeType": "Block", "src": "519:205:8", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 531, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 529, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 522, "src": "714:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 530, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 524, "src": "718:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "714:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 528, "id": 532, "nodeType": "Return", "src": "707:12:8" } ] }, "documentation": "@dev Integer division of two numbers, truncating the quotient.", "id": 534, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "div", "nodeType": "FunctionDefinition", "parameters": { "id": 525, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 522, "name": "a", "nodeType": "VariableDeclaration", "scope": 534, "src": "465:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 521, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "465:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 524, "name": "b", "nodeType": "VariableDeclaration", "scope": 534, "src": "476:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 523, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "476:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "464:22:8" }, "payable": false, "returnParameters": { "id": 528, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 527, "name": "", "nodeType": "VariableDeclaration", "scope": 534, "src": "510:7:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 526, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "510:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "509:9:8" }, "scope": 579, "src": "452:272:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 553, "nodeType": "Block", "src": "903:43:8", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 546, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 544, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 538, "src": "916:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 545, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 536, "src": "921:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "916:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 543, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "909:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 547, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "909:14:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 548, "nodeType": "ExpressionStatement", "src": "909:14:8" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 551, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 549, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 536, "src": "936:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 550, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 538, "src": "940:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "936:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 542, "id": 552, "nodeType": "Return", "src": "929:12:8" } ] }, "documentation": "@dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).", "id": 554, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "sub", "nodeType": "FunctionDefinition", "parameters": { "id": 539, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 536, "name": "a", "nodeType": "VariableDeclaration", "scope": 554, "src": "849:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 535, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "849:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 538, "name": "b", "nodeType": "VariableDeclaration", "scope": 554, "src": "860:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 537, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "860:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "848:22:8" }, "payable": false, "returnParameters": { "id": 542, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 541, "name": "", "nodeType": "VariableDeclaration", "scope": 554, "src": "894:7:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 540, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "894:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "893:9:8" }, "scope": 579, "src": "836:110:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 577, "nodeType": "Block", "src": "1077:54:8", "statements": [ { "expression": { "argumentTypes": null, "id": 567, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 563, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1083:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 566, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 564, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 556, "src": "1087:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 565, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 558, "src": "1091:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1087:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1083:9:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 568, "nodeType": "ExpressionStatement", "src": "1083:9:8" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 572, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 570, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1105:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 571, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 556, "src": "1110:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1105:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 569, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "1098:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1098:14:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 574, "nodeType": "ExpressionStatement", "src": "1098:14:8" }, { "expression": { "argumentTypes": null, "id": 575, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1125:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 562, "id": 576, "nodeType": "Return", "src": "1118:8:8" } ] }, "documentation": "@dev Adds two numbers, throws on overflow.", "id": 578, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "add", "nodeType": "FunctionDefinition", "parameters": { "id": 559, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 556, "name": "a", "nodeType": "VariableDeclaration", "scope": 578, "src": "1021:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 555, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1021:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 558, "name": "b", "nodeType": "VariableDeclaration", "scope": 578, "src": "1032:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 557, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1032:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1020:22:8" }, "payable": false, "returnParameters": { "id": 562, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 561, "name": "c", "nodeType": "VariableDeclaration", "scope": 578, "src": "1066:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 560, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1066:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1065:11:8" }, "scope": 579, "src": "1008:123:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 580, "src": "117:1016:8" } ], "src": "0:1134:8" }, "legacyAST": { "absolutePath": "/home/spalladino/Projects/openzeppelin-zos/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 579 ] }, "id": 580, "nodeType": "SourceUnit", "nodes": [ { "id": 487, "literals": [ "solidity", "^", "0.4", ".21" ], "nodeType": "PragmaDirective", "src": "0:24:8" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error", "fullyImplemented": true, "id": 579, "linearizedBaseContracts": [ 579 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 519, "nodeType": "Block", "src": "272:98:8", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 498, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 496, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "282:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 497, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "287:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "282:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 502, "nodeType": "IfStatement", "src": "278:35:8", "trueBody": { "id": 501, "nodeType": "Block", "src": "290:23:8", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 499, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "305:1:8", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 495, "id": 500, "nodeType": "Return", "src": "298:8:8" } ] } }, { "expression": { "argumentTypes": null, "id": 507, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 503, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "318:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 506, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 504, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "322:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 505, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 491, "src": "326:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "322:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "318:9:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 508, "nodeType": "ExpressionStatement", "src": "318:9:8" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 514, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 512, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 510, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "340:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 511, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 489, "src": "344:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "340:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 513, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 491, "src": "349:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "340:10:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 509, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "333:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 515, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "333:18:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 516, "nodeType": "ExpressionStatement", "src": "333:18:8" }, { "expression": { "argumentTypes": null, "id": 517, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 494, "src": "364:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 495, "id": 518, "nodeType": "Return", "src": "357:8:8" } ] }, "documentation": "@dev Multiplies two numbers, throws on overflow.", "id": 520, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "mul", "nodeType": "FunctionDefinition", "parameters": { "id": 492, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 489, "name": "a", "nodeType": "VariableDeclaration", "scope": 520, "src": "216:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 488, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "216:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 491, "name": "b", "nodeType": "VariableDeclaration", "scope": 520, "src": "227:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 490, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "227:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "215:22:8" }, "payable": false, "returnParameters": { "id": 495, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 494, "name": "c", "nodeType": "VariableDeclaration", "scope": 520, "src": "261:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 493, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "261:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "260:11:8" }, "scope": 579, "src": "203:167:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 533, "nodeType": "Block", "src": "519:205:8", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 531, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 529, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 522, "src": "714:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 530, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 524, "src": "718:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "714:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 528, "id": 532, "nodeType": "Return", "src": "707:12:8" } ] }, "documentation": "@dev Integer division of two numbers, truncating the quotient.", "id": 534, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "div", "nodeType": "FunctionDefinition", "parameters": { "id": 525, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 522, "name": "a", "nodeType": "VariableDeclaration", "scope": 534, "src": "465:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 521, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "465:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 524, "name": "b", "nodeType": "VariableDeclaration", "scope": 534, "src": "476:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 523, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "476:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "464:22:8" }, "payable": false, "returnParameters": { "id": 528, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 527, "name": "", "nodeType": "VariableDeclaration", "scope": 534, "src": "510:7:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 526, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "510:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "509:9:8" }, "scope": 579, "src": "452:272:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 553, "nodeType": "Block", "src": "903:43:8", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 546, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 544, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 538, "src": "916:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 545, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 536, "src": "921:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "916:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 543, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "909:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 547, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "909:14:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 548, "nodeType": "ExpressionStatement", "src": "909:14:8" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 551, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 549, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 536, "src": "936:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 550, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 538, "src": "940:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "936:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 542, "id": 552, "nodeType": "Return", "src": "929:12:8" } ] }, "documentation": "@dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).", "id": 554, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "sub", "nodeType": "FunctionDefinition", "parameters": { "id": 539, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 536, "name": "a", "nodeType": "VariableDeclaration", "scope": 554, "src": "849:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 535, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "849:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 538, "name": "b", "nodeType": "VariableDeclaration", "scope": 554, "src": "860:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 537, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "860:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "848:22:8" }, "payable": false, "returnParameters": { "id": 542, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 541, "name": "", "nodeType": "VariableDeclaration", "scope": 554, "src": "894:7:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 540, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "894:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "893:9:8" }, "scope": 579, "src": "836:110:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 577, "nodeType": "Block", "src": "1077:54:8", "statements": [ { "expression": { "argumentTypes": null, "id": 567, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 563, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1083:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 566, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 564, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 556, "src": "1087:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "+", "rightExpression": { "argumentTypes": null, "id": 565, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 558, "src": "1091:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1087:5:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1083:9:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 568, "nodeType": "ExpressionStatement", "src": "1083:9:8" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 572, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 570, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1105:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 571, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 556, "src": "1110:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1105:6:8", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 569, "name": "assert", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4868, "src": "1098:6:8", "typeDescriptions": { "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1098:14:8", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 574, "nodeType": "ExpressionStatement", "src": "1098:14:8" }, { "expression": { "argumentTypes": null, "id": 575, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 561, "src": "1125:1:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 562, "id": 576, "nodeType": "Return", "src": "1118:8:8" } ] }, "documentation": "@dev Adds two numbers, throws on overflow.", "id": 578, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "add", "nodeType": "FunctionDefinition", "parameters": { "id": 559, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 556, "name": "a", "nodeType": "VariableDeclaration", "scope": 578, "src": "1021:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 555, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1021:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 558, "name": "b", "nodeType": "VariableDeclaration", "scope": 578, "src": "1032:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 557, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1032:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1020:22:8" }, "payable": false, "returnParameters": { "id": 562, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 561, "name": "c", "nodeType": "VariableDeclaration", "scope": 578, "src": "1066:9:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 560, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1066:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1065:11:8" }, "scope": 579, "src": "1008:123:8", "stateMutability": "pure", "superFunction": null, "visibility": "internal" } ], "scope": 580, "src": "117:1016:8" } ], "src": "0:1134:8" }, "compiler": { "name": "solc", "version": "0.4.23+commit.124ca40d.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.0", "updatedAt": "2018-08-27T20:45:00.203Z" }