cic-internal-integration/apps/cic-eth/tests/testdata/bancor/SafeMath.json

2968 lines
117 KiB
JSON

{
"contractName": "SafeMath",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for basic math operations with overflow/underflow protection\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol\":\"SafeMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol\":{\"keccak256\":\"0x1ab7391a19ca8a3ad2f3c4a1074e080d4d76dfdb834637bdd0c1e6b6acdf28af\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://d6d8c99621ca884b72da2d84eddfec8ec8c5533915691d6eec94a07adf445608\",\"dweb:/ipfs/QmaXr6DN7VbfxfMn3PsTy7SAMgZVVXbdeaw11BsAjVL2x1\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203d1ce59e1c702fa5b7a4ebdbbe471db9a887eed169308b9570dd7668c3d42c7064736f6c634300060c0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203d1ce59e1c702fa5b7a4ebdbbe471db9a887eed169308b9570dd7668c3d42c7064736f6c634300060c0033",
"immutableReferences": {},
"sourceMap": "167:1637:60:-:0;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "167:1637:60:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\r\npragma solidity 0.6.12;\r\n\r\n/**\r\n * @dev Library for basic math operations with overflow/underflow protection\r\n*/\r\nlibrary SafeMath {\r\n /**\r\n * @dev returns the sum of _x and _y, reverts if the calculation overflows\r\n *\r\n * @param _x value 1\r\n * @param _y value 2\r\n *\r\n * @return sum\r\n */\r\n function add(uint256 _x, uint256 _y) internal pure returns (uint256) {\r\n uint256 z = _x + _y;\r\n require(z >= _x, \"ERR_OVERFLOW\");\r\n return z;\r\n }\r\n\r\n /**\r\n * @dev returns the difference of _x minus _y, reverts if the calculation underflows\r\n *\r\n * @param _x minuend\r\n * @param _y subtrahend\r\n *\r\n * @return difference\r\n */\r\n function sub(uint256 _x, uint256 _y) internal pure returns (uint256) {\r\n require(_x >= _y, \"ERR_UNDERFLOW\");\r\n return _x - _y;\r\n }\r\n\r\n /**\r\n * @dev returns the product of multiplying _x by _y, reverts if the calculation overflows\r\n *\r\n * @param _x factor 1\r\n * @param _y factor 2\r\n *\r\n * @return product\r\n */\r\n function mul(uint256 _x, uint256 _y) internal pure returns (uint256) {\r\n // gas optimization\r\n if (_x == 0)\r\n return 0;\r\n\r\n uint256 z = _x * _y;\r\n require(z / _x == _y, \"ERR_OVERFLOW\");\r\n return z;\r\n }\r\n\r\n /**\r\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\r\n *\r\n * @param _x dividend\r\n * @param _y divisor\r\n *\r\n * @return quotient\r\n */\r\n function div(uint256 _x, uint256 _y) internal pure returns (uint256) {\r\n require(_y > 0, \"ERR_DIVIDE_BY_ZERO\");\r\n uint256 c = _x / _y;\r\n return c;\r\n }\r\n}\r\n",
"sourcePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol",
"ast": {
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol",
"exportedSymbols": {
"SafeMath": [
22354
]
},
"id": 22355,
"license": "SEE LICENSE IN LICENSE",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 22244,
"literals": [
"solidity",
"0.6",
".12"
],
"nodeType": "PragmaDirective",
"src": "52:23:60"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 22245,
"nodeType": "StructuredDocumentation",
"src": "79:86:60",
"text": " @dev Library for basic math operations with overflow/underflow protection"
},
"fullyImplemented": true,
"id": 22354,
"linearizedBaseContracts": [
22354
],
"name": "SafeMath",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 22270,
"nodeType": "Block",
"src": "455:100:60",
"statements": [
{
"assignments": [
22256
],
"declarations": [
{
"constant": false,
"id": 22256,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22270,
"src": "466:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22255,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "466:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22260,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22259,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22257,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22248,
"src": "478:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"argumentTypes": null,
"id": 22258,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22250,
"src": "483:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "478:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "466:19:60"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22264,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22262,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22256,
"src": "504:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 22263,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22248,
"src": "509:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "504:7:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4f564552464c4f57",
"id": 22265,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "513:14:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
},
"value": "ERR_OVERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
}
],
"id": 22261,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "496:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22266,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "496:32:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22267,
"nodeType": "ExpressionStatement",
"src": "496:32:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22268,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22256,
"src": "546:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22254,
"id": 22269,
"nodeType": "Return",
"src": "539:8:60"
}
]
},
"documentation": {
"id": 22246,
"nodeType": "StructuredDocumentation",
"src": "191:189:60",
"text": " @dev returns the sum of _x and _y, reverts if the calculation overflows\n @param _x value 1\n @param _y value 2\n @return sum"
},
"id": 22271,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "add",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22251,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22248,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "399:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22247,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "399:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22250,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "411:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22249,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "411:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "398:24:60"
},
"returnParameters": {
"id": 22254,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22253,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "446:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22252,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "446:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "445:9:60"
},
"scope": 22354,
"src": "386:169:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22292,
"nodeType": "Block",
"src": "847:78:60",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22284,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22282,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22274,
"src": "866:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 22283,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22276,
"src": "872:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "866:8:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f554e444552464c4f57",
"id": 22285,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "876:15:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ddfa1b728b94871fcaf7b3731a21cfe44f7a2b4b84261190a1aa6f6b13e2a1f4",
"typeString": "literal_string \"ERR_UNDERFLOW\""
},
"value": "ERR_UNDERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ddfa1b728b94871fcaf7b3731a21cfe44f7a2b4b84261190a1aa6f6b13e2a1f4",
"typeString": "literal_string \"ERR_UNDERFLOW\""
}
],
"id": 22281,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "858:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22286,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "858:34:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22287,
"nodeType": "ExpressionStatement",
"src": "858:34:60"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22290,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22288,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22274,
"src": "910:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 22289,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22276,
"src": "915:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "910:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22280,
"id": 22291,
"nodeType": "Return",
"src": "903:14:60"
}
]
},
"documentation": {
"id": 22272,
"nodeType": "StructuredDocumentation",
"src": "563:209:60",
"text": " @dev returns the difference of _x minus _y, reverts if the calculation underflows\n @param _x minuend\n @param _y subtrahend\n @return difference"
},
"id": 22293,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sub",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22277,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22274,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "791:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22273,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "791:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22276,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "803:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22275,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "803:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "790:24:60"
},
"returnParameters": {
"id": 22280,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22279,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "838:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22278,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "838:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "837:9:60"
},
"scope": 22354,
"src": "778:147:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22326,
"nodeType": "Block",
"src": "1218:181:60",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22305,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22303,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1262:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22304,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1268:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1262:7:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 22308,
"nodeType": "IfStatement",
"src": "1258:34:60",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22306,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1291:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 22302,
"id": 22307,
"nodeType": "Return",
"src": "1284:8:60"
}
},
{
"assignments": [
22310
],
"declarations": [
{
"constant": false,
"id": 22310,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22326,
"src": "1305:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22309,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1305:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22314,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22313,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22311,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1317:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 22312,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22298,
"src": "1322:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1317:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1305:19:60"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22320,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22318,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22316,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22310,
"src": "1343:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 22317,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1347:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1343:6:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 22319,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22298,
"src": "1353:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1343:12:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4f564552464c4f57",
"id": 22321,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1357:14:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
},
"value": "ERR_OVERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
}
],
"id": 22315,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1335:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22322,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1335:37:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22323,
"nodeType": "ExpressionStatement",
"src": "1335:37:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22324,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22310,
"src": "1390:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22302,
"id": 22325,
"nodeType": "Return",
"src": "1383:8:60"
}
]
},
"documentation": {
"id": 22294,
"nodeType": "StructuredDocumentation",
"src": "933:210:60",
"text": " @dev returns the product of multiplying _x by _y, reverts if the calculation overflows\n @param _x factor 1\n @param _y factor 2\n @return product"
},
"id": 22327,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "mul",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22299,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22296,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1162:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22295,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1162:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22298,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1174:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22297,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1174:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1161:24:60"
},
"returnParameters": {
"id": 22302,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22301,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1209:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22300,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1209:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1208:9:60"
},
"scope": 22354,
"src": "1149:250:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22352,
"nodeType": "Block",
"src": "1696:105:60",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22340,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22338,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22332,
"src": "1715:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22339,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1720:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1715:6:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4449564944455f42595f5a45524f",
"id": 22341,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1723:20:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_80c66eaebdd007de3c36bb5849ffa95e14b2130dc26a35fe1154627fc9dd838e",
"typeString": "literal_string \"ERR_DIVIDE_BY_ZERO\""
},
"value": "ERR_DIVIDE_BY_ZERO"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_80c66eaebdd007de3c36bb5849ffa95e14b2130dc26a35fe1154627fc9dd838e",
"typeString": "literal_string \"ERR_DIVIDE_BY_ZERO\""
}
],
"id": 22337,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1707:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22342,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1707:37:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22343,
"nodeType": "ExpressionStatement",
"src": "1707:37:60"
},
{
"assignments": [
22345
],
"declarations": [
{
"constant": false,
"id": 22345,
"mutability": "mutable",
"name": "c",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22352,
"src": "1755:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22344,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1755:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22349,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22348,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22346,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22330,
"src": "1767:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 22347,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22332,
"src": "1772:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1767:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1755:19:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22350,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22345,
"src": "1792:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22336,
"id": 22351,
"nodeType": "Return",
"src": "1785:8:60"
}
]
},
"documentation": {
"id": 22328,
"nodeType": "StructuredDocumentation",
"src": "1407:214:60",
"text": " @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n @param _x dividend\n @param _y divisor\n @return quotient"
},
"id": 22353,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "div",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22333,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22330,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1640:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22329,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1640:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22332,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1652:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22331,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1652:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1639:24:60"
},
"returnParameters": {
"id": 22336,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22335,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1687:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22334,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1687:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1686:9:60"
},
"scope": 22354,
"src": "1627:174:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"scope": 22355,
"src": "167:1637:60"
}
],
"src": "52:1754:60"
},
"legacyAST": {
"absolutePath": "/home/lash/src/ext/cic/grassrootseconomics/bancor-contracts/solidity/contracts/utility/SafeMath.sol",
"exportedSymbols": {
"SafeMath": [
22354
]
},
"id": 22355,
"license": "SEE LICENSE IN LICENSE",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 22244,
"literals": [
"solidity",
"0.6",
".12"
],
"nodeType": "PragmaDirective",
"src": "52:23:60"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": {
"id": 22245,
"nodeType": "StructuredDocumentation",
"src": "79:86:60",
"text": " @dev Library for basic math operations with overflow/underflow protection"
},
"fullyImplemented": true,
"id": 22354,
"linearizedBaseContracts": [
22354
],
"name": "SafeMath",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 22270,
"nodeType": "Block",
"src": "455:100:60",
"statements": [
{
"assignments": [
22256
],
"declarations": [
{
"constant": false,
"id": 22256,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22270,
"src": "466:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22255,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "466:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22260,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22259,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22257,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22248,
"src": "478:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "+",
"rightExpression": {
"argumentTypes": null,
"id": 22258,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22250,
"src": "483:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "478:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "466:19:60"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22264,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22262,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22256,
"src": "504:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 22263,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22248,
"src": "509:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "504:7:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4f564552464c4f57",
"id": 22265,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "513:14:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
},
"value": "ERR_OVERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
}
],
"id": 22261,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "496:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22266,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "496:32:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22267,
"nodeType": "ExpressionStatement",
"src": "496:32:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22268,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22256,
"src": "546:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22254,
"id": 22269,
"nodeType": "Return",
"src": "539:8:60"
}
]
},
"documentation": {
"id": 22246,
"nodeType": "StructuredDocumentation",
"src": "191:189:60",
"text": " @dev returns the sum of _x and _y, reverts if the calculation overflows\n @param _x value 1\n @param _y value 2\n @return sum"
},
"id": 22271,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "add",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22251,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22248,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "399:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22247,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "399:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22250,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "411:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22249,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "411:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "398:24:60"
},
"returnParameters": {
"id": 22254,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22253,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22271,
"src": "446:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22252,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "446:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "445:9:60"
},
"scope": 22354,
"src": "386:169:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22292,
"nodeType": "Block",
"src": "847:78:60",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22284,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22282,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22274,
"src": "866:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 22283,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22276,
"src": "872:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "866:8:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f554e444552464c4f57",
"id": 22285,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "876:15:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ddfa1b728b94871fcaf7b3731a21cfe44f7a2b4b84261190a1aa6f6b13e2a1f4",
"typeString": "literal_string \"ERR_UNDERFLOW\""
},
"value": "ERR_UNDERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ddfa1b728b94871fcaf7b3731a21cfe44f7a2b4b84261190a1aa6f6b13e2a1f4",
"typeString": "literal_string \"ERR_UNDERFLOW\""
}
],
"id": 22281,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "858:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22286,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "858:34:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22287,
"nodeType": "ExpressionStatement",
"src": "858:34:60"
},
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22290,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22288,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22274,
"src": "910:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "-",
"rightExpression": {
"argumentTypes": null,
"id": 22289,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22276,
"src": "915:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "910:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22280,
"id": 22291,
"nodeType": "Return",
"src": "903:14:60"
}
]
},
"documentation": {
"id": 22272,
"nodeType": "StructuredDocumentation",
"src": "563:209:60",
"text": " @dev returns the difference of _x minus _y, reverts if the calculation underflows\n @param _x minuend\n @param _y subtrahend\n @return difference"
},
"id": 22293,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sub",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22277,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22274,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "791:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22273,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "791:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22276,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "803:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22275,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "803:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "790:24:60"
},
"returnParameters": {
"id": 22280,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22279,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22293,
"src": "838:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22278,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "838:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "837:9:60"
},
"scope": 22354,
"src": "778:147:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22326,
"nodeType": "Block",
"src": "1218:181:60",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22305,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22303,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1262:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22304,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1268:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1262:7:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 22308,
"nodeType": "IfStatement",
"src": "1258:34:60",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22306,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1291:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"functionReturnParameters": 22302,
"id": 22307,
"nodeType": "Return",
"src": "1284:8:60"
}
},
{
"assignments": [
22310
],
"declarations": [
{
"constant": false,
"id": 22310,
"mutability": "mutable",
"name": "z",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22326,
"src": "1305:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22309,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1305:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22314,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22313,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22311,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1317:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 22312,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22298,
"src": "1322:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1317:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1305:19:60"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22320,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22318,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22316,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22310,
"src": "1343:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 22317,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22296,
"src": "1347:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1343:6:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 22319,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22298,
"src": "1353:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1343:12:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4f564552464c4f57",
"id": 22321,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1357:14:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
},
"value": "ERR_OVERFLOW"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_5857855e77a7ad10ccf8b5bcb17297771c10c957a1c88a434eb5a16fc4dad486",
"typeString": "literal_string \"ERR_OVERFLOW\""
}
],
"id": 22315,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1335:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22322,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1335:37:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22323,
"nodeType": "ExpressionStatement",
"src": "1335:37:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22324,
"name": "z",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22310,
"src": "1390:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22302,
"id": 22325,
"nodeType": "Return",
"src": "1383:8:60"
}
]
},
"documentation": {
"id": 22294,
"nodeType": "StructuredDocumentation",
"src": "933:210:60",
"text": " @dev returns the product of multiplying _x by _y, reverts if the calculation overflows\n @param _x factor 1\n @param _y factor 2\n @return product"
},
"id": 22327,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "mul",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22299,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22296,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1162:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22295,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1162:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22298,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1174:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22297,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1174:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1161:24:60"
},
"returnParameters": {
"id": 22302,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22301,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22327,
"src": "1209:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22300,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1209:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1208:9:60"
},
"scope": 22354,
"src": "1149:250:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 22352,
"nodeType": "Block",
"src": "1696:105:60",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22340,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22338,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22332,
"src": "1715:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 22339,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1720:1:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1715:6:60",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "4552525f4449564944455f42595f5a45524f",
"id": 22341,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1723:20:60",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_80c66eaebdd007de3c36bb5849ffa95e14b2130dc26a35fe1154627fc9dd838e",
"typeString": "literal_string \"ERR_DIVIDE_BY_ZERO\""
},
"value": "ERR_DIVIDE_BY_ZERO"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_80c66eaebdd007de3c36bb5849ffa95e14b2130dc26a35fe1154627fc9dd838e",
"typeString": "literal_string \"ERR_DIVIDE_BY_ZERO\""
}
],
"id": 22337,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
-18,
-18
],
"referencedDeclaration": -18,
"src": "1707:7:60",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 22342,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1707:37:60",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 22343,
"nodeType": "ExpressionStatement",
"src": "1707:37:60"
},
{
"assignments": [
22345
],
"declarations": [
{
"constant": false,
"id": 22345,
"mutability": "mutable",
"name": "c",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22352,
"src": "1755:9:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22344,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1755:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 22349,
"initialValue": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 22348,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 22346,
"name": "_x",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22330,
"src": "1767:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"id": 22347,
"name": "_y",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22332,
"src": "1772:2:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1767:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1755:19:60"
},
{
"expression": {
"argumentTypes": null,
"id": 22350,
"name": "c",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 22345,
"src": "1792:1:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 22336,
"id": 22351,
"nodeType": "Return",
"src": "1785:8:60"
}
]
},
"documentation": {
"id": 22328,
"nodeType": "StructuredDocumentation",
"src": "1407:214:60",
"text": " @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n @param _x dividend\n @param _y divisor\n @return quotient"
},
"id": 22353,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "div",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 22333,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22330,
"mutability": "mutable",
"name": "_x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1640:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22329,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1640:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 22332,
"mutability": "mutable",
"name": "_y",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1652:10:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22331,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1652:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1639:24:60"
},
"returnParameters": {
"id": 22336,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 22335,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 22353,
"src": "1687:7:60",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 22334,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1687:7:60",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1686:9:60"
},
"scope": 22354,
"src": "1627:174:60",
"stateMutability": "pure",
"virtual": false,
"visibility": "internal"
}
],
"scope": 22355,
"src": "167:1637:60"
}
],
"src": "52:1754:60"
},
"compiler": {
"name": "solc",
"version": "0.6.12+commit.27d51765.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.2.3",
"updatedAt": "2020-10-20T08:24:47.844Z",
"devdoc": {
"details": "Library for basic math operations with overflow/underflow protection",
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}