UNPKG

@realitio/realitio-contracts

Version:

Collection of smart contracts for the Realitio fact verification platform

1,044 lines 657 kB
{ "contractName": "SafeMath", "abi": [], "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820f715466470b03d2605e1700ea125665d26e2861a0c942fcaa12ed45070a6619e0029", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820f715466470b03d2605e1700ea125665d26e2861a0c942fcaa12ed45070a6619e0029", "sourceMap": "117:1676:4:-;;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:1676:4:-;;;;;;;;", "source": "pragma solidity ^0.4.25;\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two numbers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n\n/**\n * @title ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/20\n */\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n/**\n * @title Standard ERC20 token\n *\n * @dev Implementation of the basic standard token.\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md\n * Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol\n */\ncontract ERC20 is IERC20 {\n using SafeMath for uint256;\n\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowed;\n\n uint256 private _totalSupply;\n\n function mint(address to, uint256 val) \n public {\n _mint(to, val);\n }\n\n /**\n * @dev Total number of tokens in existence\n */\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Gets the balance of the specified address.\n * @param owner The address to query the balance of.\n * @return An uint256 representing the amount owned by the passed address.\n */\n function balanceOf(address owner) public view returns (uint256) {\n return _balances[owner];\n }\n\n /**\n * @dev Function to check the amount of tokens that an owner allowed to a spender.\n * @param owner address The address which owns the funds.\n * @param spender address The address which will spend the funds.\n * @return A uint256 specifying the amount of tokens still available for the spender.\n */\n function allowance(address owner, address spender) public view returns (uint256) {\n return _allowed[owner][spender];\n }\n\n /**\n * @dev Transfer token for a specified address\n * @param to The address to transfer to.\n * @param value The amount to be transferred.\n */\n function transfer(address to, uint256 value) public returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n /**\n * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n * Beware that changing an allowance with this method brings the risk that someone may use both the old\n * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n */\n function approve(address spender, uint256 value) public returns (bool) {\n require(spender != address(0));\n\n _allowed[msg.sender][spender] = value;\n emit Approval(msg.sender, spender, value);\n return true;\n }\n\n /**\n * @dev Transfer tokens from one address to another\n * @param from address The address which you want to send tokens from\n * @param to address The address which you want to transfer to\n * @param value uint256 the amount of tokens to be transferred\n */\n function transferFrom(address from, address to, uint256 value) public returns (bool) {\n _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Increase the amount of tokens that an owner allowed to a spender.\n * approve should be called when allowed_[_spender] == 0. To increment\n * allowed value is better to use this function to avoid 2 calls (and wait until\n * the first transaction is mined)\n * From MonolithDAO Token.sol\n * @param spender The address which will spend the funds.\n * @param addedValue The amount of tokens to increase the allowance by.\n */\n function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {\n require(spender != address(0));\n\n _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);\n emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);\n return true;\n }\n\n /**\n * @dev Decrease the amount of tokens that an owner allowed to a spender.\n * approve should be called when allowed_[_spender] == 0. To decrement\n * allowed value is better to use this function to avoid 2 calls (and wait until\n * the first transaction is mined)\n * From MonolithDAO Token.sol\n * @param spender The address which will spend the funds.\n * @param subtractedValue The amount of tokens to decrease the allowance by.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {\n require(spender != address(0));\n\n _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);\n emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);\n return true;\n }\n\n /**\n * @dev Transfer token for a specified addresses\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param value The amount to be transferred.\n */\n function _transfer(address from, address to, uint256 value) internal {\n require(to != address(0));\n\n _balances[from] = _balances[from].sub(value);\n _balances[to] = _balances[to].add(value);\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Internal function that mints an amount of the token and assigns it to\n * an account. This encapsulates the modification of balances such that the\n * proper events are emitted.\n * @param account The account that will receive the created tokens.\n * @param value The amount that will be created.\n */\n function _mint(address account, uint256 value) internal {\n require(account != address(0));\n\n _totalSupply = _totalSupply.add(value);\n _balances[account] = _balances[account].add(value);\n emit Transfer(address(0), account, value);\n }\n\n /**\n * @dev Internal function that burns an amount of the token of a given\n * account.\n * @param account The account whose tokens will be burnt.\n * @param value The amount that will be burnt.\n */\n function _burn(address account, uint256 value) internal {\n require(account != address(0));\n\n _totalSupply = _totalSupply.sub(value);\n _balances[account] = _balances[account].sub(value);\n emit Transfer(account, address(0), value);\n }\n\n /**\n * @dev Internal function that burns an amount of the token of a given\n * account, deducting from the sender's allowance for said account. Uses the\n * internal burn function.\n * @param account The account whose tokens will be burnt.\n * @param value The amount that will be burnt.\n */\n function _burnFrom(address account, uint256 value) internal {\n // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,\n // this function needs to emit an event with the updated approval.\n _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);\n _burn(account, value);\n }\n}\n", "sourcePath": "/home/ed/working/realitio-contracts/truffle/contracts/ERC20Token.sol", "ast": { "absolutePath": "/home/ed/working/realitio-contracts/truffle/contracts/ERC20Token.sol", "exportedSymbols": { "ERC20": [ 1132 ], "IERC20": [ 715 ], "SafeMath": [ 648 ] }, "id": 1133, "nodeType": "SourceUnit", "nodes": [ { "id": 522, "literals": [ "solidity", "^", "0.4", ".25" ], "nodeType": "PragmaDirective", "src": "0:24:4" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title SafeMath\n@dev Math operations with safety checks that revert on error", "fullyImplemented": true, "id": 648, "linearizedBaseContracts": [ 648 ], "name": "SafeMath", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 554, "nodeType": "Block", "src": "278:354:4", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 533, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 531, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 524, "src": "509:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 532, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "514:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "509:6:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 537, "nodeType": "IfStatement", "src": "505:45:4", "trueBody": { "id": 536, "nodeType": "Block", "src": "517:33:4", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "30", "id": 534, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "538:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "functionReturnParameters": 530, "id": 535, "nodeType": "Return", "src": "531:8:4" } ] } }, { "assignments": [ 539 ], "declarations": [ { "constant": false, "id": 539, "name": "c", "nodeType": "VariableDeclaration", "scope": 555, "src": "560:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 538, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "560:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 543, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 542, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 540, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 524, "src": "572:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "*", "rightExpression": { "argumentTypes": null, "id": 541, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 526, "src": "576:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "572:5:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "560:17:4" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 549, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 547, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 545, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 539, "src": "595:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 546, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 524, "src": "599:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "595:5:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 548, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 526, "src": "604:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "595:10:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 544, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 9706, 9707 ], "referencedDeclaration": 9706, "src": "587:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 550, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "587:19:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 551, "nodeType": "ExpressionStatement", "src": "587:19:4" }, { "expression": { "argumentTypes": null, "id": 552, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 539, "src": "624:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 530, "id": 553, "nodeType": "Return", "src": "617:8:4" } ] }, "documentation": "@dev Multiplies two numbers, reverts on overflow.", "id": 555, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "mul", "nodeType": "FunctionDefinition", "parameters": { "id": 527, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 524, "name": "a", "nodeType": "VariableDeclaration", "scope": 555, "src": "224:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 523, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "224:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 526, "name": "b", "nodeType": "VariableDeclaration", "scope": 555, "src": "235:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 525, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "235:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "223:22:4" }, "payable": false, "returnParameters": { "id": 530, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 529, "name": "", "nodeType": "VariableDeclaration", "scope": 555, "src": "269:7:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 528, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "269:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "268:9:4" }, "scope": 648, "src": "211:421:4", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 578, "nodeType": "Block", "src": "817:229:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 567, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 565, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 559, "src": "901:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 566, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "905:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "901:5:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 564, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 9706, 9707 ], "referencedDeclaration": 9706, "src": "893:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 568, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "893:14:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 569, "nodeType": "ExpressionStatement", "src": "893:14:4" }, { "assignments": [ 571 ], "declarations": [ { "constant": false, "id": 571, "name": "c", "nodeType": "VariableDeclaration", "scope": 579, "src": "917:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 570, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "917:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 575, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 574, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 572, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 557, "src": "929:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "/", "rightExpression": { "argumentTypes": null, "id": 573, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 559, "src": "933:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "929:5:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "917:17:4" }, { "expression": { "argumentTypes": null, "id": 576, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 571, "src": "1038:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 563, "id": 577, "nodeType": "Return", "src": "1031:8:4" } ] }, "documentation": "@dev Integer division of two numbers truncating the quotient, reverts on division by zero.", "id": 579, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "div", "nodeType": "FunctionDefinition", "parameters": { "id": 560, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 557, "name": "a", "nodeType": "VariableDeclaration", "scope": 579, "src": "763:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 556, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "763:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 559, "name": "b", "nodeType": "VariableDeclaration", "scope": 579, "src": "774:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 558, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "774:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "762:22:4" }, "payable": false, "returnParameters": { "id": 563, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 562, "name": "", "nodeType": "VariableDeclaration", "scope": 579, "src": "808:7:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 561, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "808:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "807:9:4" }, "scope": 648, "src": "750:296:4", "stateMutability": "pure", "superFunction": null, "visibility": "internal" }, { "body": { "id": 602, "nodeType": "Block", "src": "1234:78:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 591, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 589, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 583, "src": "1252:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<=", "rightExpression": { "argumentTypes": null, "id": 590, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 581, "src": "1257:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1252:6:4", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 588, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 9706, 9707 ], "referencedDeclaration": 9706, "src": "1244:7:4", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 592, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1244:15:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 593, "nodeType": "ExpressionStatement", "src": "1244:15:4" }, { "assignments": [ 595 ], "declarations": [ { "constant": false, "id": 595, "name": "c", "nodeType": "VariableDeclaration", "scope": 603, "src": "1269:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 594, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1269:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 599, "initialValue": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 598, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 596, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 581, "src": "1281:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "-", "rightExpression": { "argumentTypes": null, "id": 597, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 583, "src": "1285:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1281:5:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "VariableDeclarationStatement", "src": "1269:17:4" }, { "expression": { "argumentTypes": null, "id": 600, "name": "c", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 595, "src": "1304:1:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 587, "id": 601, "nodeType": "Return", "src": "1297:8:4" } ] }, "documentation": "@dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).", "id": 603, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "sub", "nodeType": "FunctionDefinition", "parameters": { "id": 584, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 581, "name": "a", "nodeType": "VariableDeclaration", "scope": 603, "src": "1180:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 580, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1180:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 583, "name": "b", "nodeType": "VariableDeclaration", "scope": 603, "src": "1191:9:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 582, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1191:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "s