{ "contractName": "SafeMath", "abi": [], "bytecode": "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820ade971e1217d2b46e53509269e46ac252cbe23c158328da3d9e4cd0a7f16e8da0029", "deployedBytecode": "0x6060604052600080fd00a165627a7a72305820ade971e1217d2b46e53509269e46ac252cbe23c158328da3d9e4cd0a7f16e8da0029", "sourceMap": "117:698:1:-;;;;;;;;;;;;;;;;;", "deployedSourceMap": "117:698:1:-;;;;;", "source": "pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal constant returns (uint256) {\n uint256 c = a * b;\n assert(a == 0 || c / a == b);\n return c;\n }\n\n function div(uint256 a, uint256 b) internal constant 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 c;\n }\n\n function sub(uint256 a, uint256 b) internal constant returns (uint256) {\n assert(b <= a);\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal constant returns (uint256) {\n uint256 c = a + b;\n assert(c >= a);\n return c;\n }\n}\n", "sourcePath": "zeppelin-solidity/contracts/math/SafeMath.sol", "ast": { "attributes": { "absolutePath": "zeppelin-solidity/contracts/math/SafeMath.sol", "exportedSymbols": { "SafeMath": [ 432 ] } }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.4", ".11" ] }, "id": 339, "name": "PragmaDirective", "src": "0:24:1" }, { "attributes": { "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "library", "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error", "fullyImplemented": true, "linearizedBaseContracts": [ 432 ], "name": "SafeMath", "scope": 433 }, "children": [ { "attributes": { "constant": true, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "mul", "payable": false, "scope": 432, "stateMutability": "view", "superFunction": null, "visibility": "internal" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "a", "scope": 369, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 340, "name": "ElementaryTypeName", "src": "151:7:1" } ], "id": 341, "name": "VariableDeclaration", "src": "151:9:1" }, { "attributes": { "constant": false, "name": "b", "scope": 369, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 342, "name": "ElementaryTypeName", "src": "162:7:1" } ], "id": 343, "name": "VariableDeclaration", "src": "162:9:1" } ], "id": 344, "name": "ParameterList", "src": "150:22:1" }, { "children": [ { "attributes": { "constant": false, "name": "", "scope": 369, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 345, "name": "ElementaryTypeName", "src": "200:7:1" } ], "id": 346, "name": "VariableDeclaration", "src": "200:7:1" } ], "id": 347, "name": "ParameterList", "src": "199:9:1" }, { "children": [ { "attributes": { "assignments": [ 349 ] }, "children": [ { "attributes": { "constant": false, "name": "c", "scope": 369, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 348, "name": "ElementaryTypeName", "src": "215:7:1" } ], "id": 349, "name": "VariableDeclaration", "src": "215:9:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "*", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 341, "type": "uint256", "value": "a" }, "id": 350, "name": "Identifier", "src": "227:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 343, "type": "uint256", "value": "b" }, "id": 351, "name": "Identifier", "src": "231:1:1" } ], "id": 352, "name": "BinaryOperation", "src": "227:5:1" } ], "id": 353, "name": "VariableDeclarationStatement", "src": "215:17:1" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "tuple()", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "overloadedDeclarations": [ null ], "referencedDeclaration": 597, "type": "function (bool) pure", "value": "assert" }, "id": 354, "name": "Identifier", "src": "238:6:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "||", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "==", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 341, "type": "uint256", "value": "a" }, "id": 355, "name": "Identifier", "src": "245:1:1" }, { "attributes": { "argumentTypes": null, "hexvalue": "30", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "number", "type": "int_const 0", "value": "0" }, "id": 356, "name": "Literal", "src": "250:1:1" } ], "id": 357, "name": "BinaryOperation", "src": "245:6:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "==", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "/", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 349, "type": "uint256", "value": "c" }, "id": 358, "name": "Identifier", "src": "255:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 341, "type": "uint256", "value": "a" }, "id": 359, "name": "Identifier", "src": "259:1:1" } ], "id": 360, "name": "BinaryOperation", "src": "255:5:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 343, "type": "uint256", "value": "b" }, "id": 361, "name": "Identifier", "src": "264:1:1" } ], "id": 362, "name": "BinaryOperation", "src": "255:10:1" } ], "id": 363, "name": "BinaryOperation", "src": "245:20:1" } ], "id": 364, "name": "FunctionCall", "src": "238:28:1" } ], "id": 365, "name": "ExpressionStatement", "src": "238:28:1" }, { "attributes": { "functionReturnParameters": 347 }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 349, "type": "uint256", "value": "c" }, "id": 366, "name": "Identifier", "src": "279:1:1" } ], "id": 367, "name": "Return", "src": "272:8:1" } ], "id": 368, "name": "Block", "src": "209:76:1" } ], "id": 369, "name": "FunctionDefinition", "src": "138:147:1" }, { "attributes": { "constant": true, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "div", "payable": false, "scope": 432, "stateMutability": "view", "superFunction": null, "visibility": "internal" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "a", "scope": 387, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 370, "name": "ElementaryTypeName", "src": "302:7:1" } ], "id": 371, "name": "VariableDeclaration", "src": "302:9:1" }, { "attributes": { "constant": false, "name": "b", "scope": 387, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 372, "name": "ElementaryTypeName", "src": "313:7:1" } ], "id": 373, "name": "VariableDeclaration", "src": "313:9:1" } ], "id": 374, "name": "ParameterList", "src": "301:22:1" }, { "children": [ { "attributes": { "constant": false, "name": "", "scope": 387, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 375, "name": "ElementaryTypeName", "src": "351:7:1" } ], "id": 376, "name": "VariableDeclaration", "src": "351:7:1" } ], "id": 377, "name": "ParameterList", "src": "350:9:1" }, { "children": [ { "attributes": { "assignments": [ 379 ] }, "children": [ { "attributes": { "constant": false, "name": "c", "scope": 387, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 378, "name": "ElementaryTypeName", "src": "440:7:1" } ], "id": 379, "name": "VariableDeclaration", "src": "440:9:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "/", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 371, "type": "uint256", "value": "a" }, "id": 380, "name": "Identifier", "src": "452:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 373, "type": "uint256", "value": "b" }, "id": 381, "name": "Identifier", "src": "456:1:1" } ], "id": 382, "name": "BinaryOperation", "src": "452:5:1" } ], "id": 383, "name": "VariableDeclarationStatement", "src": "440:17:1" }, { "attributes": { "functionReturnParameters": 377 }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 379, "type": "uint256", "value": "c" }, "id": 384, "name": "Identifier", "src": "552:1:1" } ], "id": 385, "name": "Return", "src": "545:8:1" } ], "id": 386, "name": "Block", "src": "360:198:1" } ], "id": 387, "name": "FunctionDefinition", "src": "289:269:1" }, { "attributes": { "constant": true, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "sub", "payable": false, "scope": 432, "stateMutability": "view", "superFunction": null, "visibility": "internal" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "a", "scope": 407, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 388, "name": "ElementaryTypeName", "src": "575:7:1" } ], "id": 389, "name": "VariableDeclaration", "src": "575:9:1" }, { "attributes": { "constant": false, "name": "b", "scope": 407, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 390, "name": "ElementaryTypeName", "src": "586:7:1" } ], "id": 391, "name": "VariableDeclaration", "src": "586:9:1" } ], "id": 392, "name": "ParameterList", "src": "574:22:1" }, { "children": [ { "attributes": { "constant": false, "name": "", "scope": 407, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 393, "name": "ElementaryTypeName", "src": "624:7:1" } ], "id": 394, "name": "VariableDeclaration", "src": "624:7:1" } ], "id": 395, "name": "ParameterList", "src": "623:9:1" }, { "children": [ { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "tuple()", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "overloadedDeclarations": [ null ], "referencedDeclaration": 597, "type": "function (bool) pure", "value": "assert" }, "id": 396, "name": "Identifier", "src": "639:6:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "<=", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 391, "type": "uint256", "value": "b" }, "id": 397, "name": "Identifier", "src": "646:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 389, "type": "uint256", "value": "a" }, "id": 398, "name": "Identifier", "src": "651:1:1" } ], "id": 399, "name": "BinaryOperation", "src": "646:6:1" } ], "id": 400, "name": "FunctionCall", "src": "639:14:1" } ], "id": 401, "name": "ExpressionStatement", "src": "639:14:1" }, { "attributes": { "functionReturnParameters": 395 }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "-", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 389, "type": "uint256", "value": "a" }, "id": 402, "name": "Identifier", "src": "666:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 391, "type": "uint256", "value": "b" }, "id": 403, "name": "Identifier", "src": "670:1:1" } ], "id": 404, "name": "BinaryOperation", "src": "666:5:1" } ], "id": 405, "name": "Return", "src": "659:12:1" } ], "id": 406, "name": "Block", "src": "633:43:1" } ], "id": 407, "name": "FunctionDefinition", "src": "562:114:1" }, { "attributes": { "constant": true, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "add", "payable": false, "scope": 432, "stateMutability": "view", "superFunction": null, "visibility": "internal" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "a", "scope": 431, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 408, "name": "ElementaryTypeName", "src": "693:7:1" } ], "id": 409, "name": "VariableDeclaration", "src": "693:9:1" }, { "attributes": { "constant": false, "name": "b", "scope": 431, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 410, "name": "ElementaryTypeName", "src": "704:7:1" } ], "id": 411, "name": "VariableDeclaration", "src": "704:9:1" } ], "id": 412, "name": "ParameterList", "src": "692:22:1" }, { "children": [ { "attributes": { "constant": false, "name": "", "scope": 431, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 413, "name": "ElementaryTypeName", "src": "742:7:1" } ], "id": 414, "name": "VariableDeclaration", "src": "742:7:1" } ], "id": 415, "name": "ParameterList", "src": "741:9:1" }, { "children": [ { "attributes": { "assignments": [ 417 ] }, "children": [ { "attributes": { "constant": false, "name": "c", "scope": 431, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 416, "name": "ElementaryTypeName", "src": "757:7:1" } ], "id": 417, "name": "VariableDeclaration", "src": "757:9:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "+", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 409, "type": "uint256", "value": "a" }, "id": 418, "name": "Identifier", "src": "769:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 411, "type": "uint256", "value": "b" }, "id": 419, "name": "Identifier", "src": "773:1:1" } ], "id": 420, "name": "BinaryOperation", "src": "769:5:1" } ], "id": 421, "name": "VariableDeclarationStatement", "src": "757:17:1" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "tuple()", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "overloadedDeclarations": [ null ], "referencedDeclaration": 597, "type": "function (bool) pure", "value": "assert" }, "id": 422, "name": "Identifier", "src": "780:6:1" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": ">=", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 417, "type": "uint256", "value": "c" }, "id": 423, "name": "Identifier", "src": "787:1:1" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 409, "type": "uint256", "value": "a" }, "id": 424, "name": "Identifier", "src": "792:1:1" } ], "id": 425, "name": "BinaryOperation", "src": "787:6:1" } ], "id": 426, "name": "FunctionCall", "src": "780:14:1" } ], "id": 427, "name": "ExpressionStatement", "src": "780:14:1" }, { "attributes": { "functionReturnParameters": 415 }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 417, "type": "uint256", "value": "c" }, "id": 428, "name": "Identifier", "src": "807:1:1" } ], "id": 429, "name": "Return", "src": "800:8:1" } ], "id": 430, "name": "Block", "src": "751:62:1" } ], "id": 431, "name": "FunctionDefinition", "src": "680:133:1" } ], "id": 432, "name": "ContractDefinition", "src": "117:698:1" } ], "id": 433, "name": "SourceUnit", "src": "0:816:1" }, "compiler": { "name": "solc", "version": "0.4.18+commit.9cf6e910.Emscripten.clang" }, "networks": {}, "schemaVersion": "1.0.1", "updatedAt": "2017-11-10T02:14:36.614Z" }