@netvote/elections-solidity
Version:
Elections Contracts
1,268 lines (1,267 loc) • 51.6 kB
JSON
{
"contractName": "SafeMath",
"abi": [],
"bytecode": "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058207bbc98c12bf84b514cc3fc38d47cece4332ab1c36199c5e655c61cc2bf6182590029",
"deployedBytecode": "0x6060604052600080fd00a165627a7a723058207bbc98c12bf84b514cc3fc38d47cece4332ab1c36199c5e655c61cc2bf6182590029",
"sourceMap": "117:698:20:-;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "117:698:20:-;;;;;",
"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": [
2647
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".11"
]
},
"id": 2554,
"name": "PragmaDirective",
"src": "0:24:20"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error",
"fullyImplemented": true,
"linearizedBaseContracts": [
2647
],
"name": "SafeMath",
"scope": 2648
},
"children": [
{
"attributes": {
"constant": true,
"implemented": true,
"isConstructor": false,
"modifiers": [
null
],
"name": "mul",
"payable": false,
"scope": 2647,
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "a",
"scope": 2584,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2555,
"name": "ElementaryTypeName",
"src": "151:7:20"
}
],
"id": 2556,
"name": "VariableDeclaration",
"src": "151:9:20"
},
{
"attributes": {
"constant": false,
"name": "b",
"scope": 2584,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2557,
"name": "ElementaryTypeName",
"src": "162:7:20"
}
],
"id": 2558,
"name": "VariableDeclaration",
"src": "162:9:20"
}
],
"id": 2559,
"name": "ParameterList",
"src": "150:22:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 2584,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2560,
"name": "ElementaryTypeName",
"src": "200:7:20"
}
],
"id": 2561,
"name": "VariableDeclaration",
"src": "200:7:20"
}
],
"id": 2562,
"name": "ParameterList",
"src": "199:9:20"
},
{
"children": [
{
"attributes": {
"assignments": [
2564
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "c",
"scope": 2584,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2563,
"name": "ElementaryTypeName",
"src": "215:7:20"
}
],
"id": 2564,
"name": "VariableDeclaration",
"src": "215:9:20"
},
{
"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": 2556,
"type": "uint256",
"value": "a"
},
"id": 2565,
"name": "Identifier",
"src": "227:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2558,
"type": "uint256",
"value": "b"
},
"id": 2566,
"name": "Identifier",
"src": "231:1:20"
}
],
"id": 2567,
"name": "BinaryOperation",
"src": "227:5:20"
}
],
"id": 2568,
"name": "VariableDeclarationStatement",
"src": "215:17:20"
},
{
"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": 3229,
"type": "function (bool) pure",
"value": "assert"
},
"id": 2569,
"name": "Identifier",
"src": "238:6:20"
},
{
"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": 2556,
"type": "uint256",
"value": "a"
},
"id": 2570,
"name": "Identifier",
"src": "245:1:20"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "30",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 0",
"value": "0"
},
"id": 2571,
"name": "Literal",
"src": "250:1:20"
}
],
"id": 2572,
"name": "BinaryOperation",
"src": "245:6:20"
},
{
"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": 2564,
"type": "uint256",
"value": "c"
},
"id": 2573,
"name": "Identifier",
"src": "255:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2556,
"type": "uint256",
"value": "a"
},
"id": 2574,
"name": "Identifier",
"src": "259:1:20"
}
],
"id": 2575,
"name": "BinaryOperation",
"src": "255:5:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2558,
"type": "uint256",
"value": "b"
},
"id": 2576,
"name": "Identifier",
"src": "264:1:20"
}
],
"id": 2577,
"name": "BinaryOperation",
"src": "255:10:20"
}
],
"id": 2578,
"name": "BinaryOperation",
"src": "245:20:20"
}
],
"id": 2579,
"name": "FunctionCall",
"src": "238:28:20"
}
],
"id": 2580,
"name": "ExpressionStatement",
"src": "238:28:20"
},
{
"attributes": {
"functionReturnParameters": 2562
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2564,
"type": "uint256",
"value": "c"
},
"id": 2581,
"name": "Identifier",
"src": "279:1:20"
}
],
"id": 2582,
"name": "Return",
"src": "272:8:20"
}
],
"id": 2583,
"name": "Block",
"src": "209:76:20"
}
],
"id": 2584,
"name": "FunctionDefinition",
"src": "138:147:20"
},
{
"attributes": {
"constant": true,
"implemented": true,
"isConstructor": false,
"modifiers": [
null
],
"name": "div",
"payable": false,
"scope": 2647,
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "a",
"scope": 2602,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2585,
"name": "ElementaryTypeName",
"src": "302:7:20"
}
],
"id": 2586,
"name": "VariableDeclaration",
"src": "302:9:20"
},
{
"attributes": {
"constant": false,
"name": "b",
"scope": 2602,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2587,
"name": "ElementaryTypeName",
"src": "313:7:20"
}
],
"id": 2588,
"name": "VariableDeclaration",
"src": "313:9:20"
}
],
"id": 2589,
"name": "ParameterList",
"src": "301:22:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 2602,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2590,
"name": "ElementaryTypeName",
"src": "351:7:20"
}
],
"id": 2591,
"name": "VariableDeclaration",
"src": "351:7:20"
}
],
"id": 2592,
"name": "ParameterList",
"src": "350:9:20"
},
{
"children": [
{
"attributes": {
"assignments": [
2594
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "c",
"scope": 2602,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2593,
"name": "ElementaryTypeName",
"src": "440:7:20"
}
],
"id": 2594,
"name": "VariableDeclaration",
"src": "440:9:20"
},
{
"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": 2586,
"type": "uint256",
"value": "a"
},
"id": 2595,
"name": "Identifier",
"src": "452:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2588,
"type": "uint256",
"value": "b"
},
"id": 2596,
"name": "Identifier",
"src": "456:1:20"
}
],
"id": 2597,
"name": "BinaryOperation",
"src": "452:5:20"
}
],
"id": 2598,
"name": "VariableDeclarationStatement",
"src": "440:17:20"
},
{
"attributes": {
"functionReturnParameters": 2592
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2594,
"type": "uint256",
"value": "c"
},
"id": 2599,
"name": "Identifier",
"src": "552:1:20"
}
],
"id": 2600,
"name": "Return",
"src": "545:8:20"
}
],
"id": 2601,
"name": "Block",
"src": "360:198:20"
}
],
"id": 2602,
"name": "FunctionDefinition",
"src": "289:269:20"
},
{
"attributes": {
"constant": true,
"implemented": true,
"isConstructor": false,
"modifiers": [
null
],
"name": "sub",
"payable": false,
"scope": 2647,
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "a",
"scope": 2622,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2603,
"name": "ElementaryTypeName",
"src": "575:7:20"
}
],
"id": 2604,
"name": "VariableDeclaration",
"src": "575:9:20"
},
{
"attributes": {
"constant": false,
"name": "b",
"scope": 2622,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2605,
"name": "ElementaryTypeName",
"src": "586:7:20"
}
],
"id": 2606,
"name": "VariableDeclaration",
"src": "586:9:20"
}
],
"id": 2607,
"name": "ParameterList",
"src": "574:22:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 2622,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2608,
"name": "ElementaryTypeName",
"src": "624:7:20"
}
],
"id": 2609,
"name": "VariableDeclaration",
"src": "624:7:20"
}
],
"id": 2610,
"name": "ParameterList",
"src": "623:9:20"
},
{
"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": 3229,
"type": "function (bool) pure",
"value": "assert"
},
"id": 2611,
"name": "Identifier",
"src": "639:6:20"
},
{
"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": 2606,
"type": "uint256",
"value": "b"
},
"id": 2612,
"name": "Identifier",
"src": "646:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2604,
"type": "uint256",
"value": "a"
},
"id": 2613,
"name": "Identifier",
"src": "651:1:20"
}
],
"id": 2614,
"name": "BinaryOperation",
"src": "646:6:20"
}
],
"id": 2615,
"name": "FunctionCall",
"src": "639:14:20"
}
],
"id": 2616,
"name": "ExpressionStatement",
"src": "639:14:20"
},
{
"attributes": {
"functionReturnParameters": 2610
},
"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": 2604,
"type": "uint256",
"value": "a"
},
"id": 2617,
"name": "Identifier",
"src": "666:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2606,
"type": "uint256",
"value": "b"
},
"id": 2618,
"name": "Identifier",
"src": "670:1:20"
}
],
"id": 2619,
"name": "BinaryOperation",
"src": "666:5:20"
}
],
"id": 2620,
"name": "Return",
"src": "659:12:20"
}
],
"id": 2621,
"name": "Block",
"src": "633:43:20"
}
],
"id": 2622,
"name": "FunctionDefinition",
"src": "562:114:20"
},
{
"attributes": {
"constant": true,
"implemented": true,
"isConstructor": false,
"modifiers": [
null
],
"name": "add",
"payable": false,
"scope": 2647,
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "a",
"scope": 2646,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2623,
"name": "ElementaryTypeName",
"src": "693:7:20"
}
],
"id": 2624,
"name": "VariableDeclaration",
"src": "693:9:20"
},
{
"attributes": {
"constant": false,
"name": "b",
"scope": 2646,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2625,
"name": "ElementaryTypeName",
"src": "704:7:20"
}
],
"id": 2626,
"name": "VariableDeclaration",
"src": "704:9:20"
}
],
"id": 2627,
"name": "ParameterList",
"src": "692:22:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 2646,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2628,
"name": "ElementaryTypeName",
"src": "742:7:20"
}
],
"id": 2629,
"name": "VariableDeclaration",
"src": "742:7:20"
}
],
"id": 2630,
"name": "ParameterList",
"src": "741:9:20"
},
{
"children": [
{
"attributes": {
"assignments": [
2632
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "c",
"scope": 2646,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 2631,
"name": "ElementaryTypeName",
"src": "757:7:20"
}
],
"id": 2632,
"name": "VariableDeclaration",
"src": "757:9:20"
},
{
"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": 2624,
"type": "uint256",
"value": "a"
},
"id": 2633,
"name": "Identifier",
"src": "769:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2626,
"type": "uint256",
"value": "b"
},
"id": 2634,
"name": "Identifier",
"src": "773:1:20"
}
],
"id": 2635,
"name": "BinaryOperation",
"src": "769:5:20"
}
],
"id": 2636,
"name": "VariableDeclarationStatement",
"src": "757:17:20"
},
{
"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": 3229,
"type": "function (bool) pure",
"value": "assert"
},
"id": 2637,
"name": "Identifier",
"src": "780:6:20"
},
{
"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": 2632,
"type": "uint256",
"value": "c"
},
"id": 2638,
"name": "Identifier",
"src": "787:1:20"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 2624,
"type": "uint256",
"value": "a"
},
"id": 2639,
"name": "Identifier",
"src": "792:1:20"
}
],
"id": 2640,
"name": "BinaryOperation",
"src": "787:6:20"
}
],
"id": 2641,
"name": "FunctionCall",
"src": "780:14:20"
}
],