UNPKG

@netvote/elections-solidity

Version:
1,177 lines 49.7 kB
{ "contractName": "BasicToken", "abi": [ { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "balance", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transfer", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" } ], "bytecode": "0x6060604052341561000f57600080fd5b6102208061001e6000396000f3006060604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166318160ddd811461005b57806370a0823114610080578063a9059cbb1461009f575b600080fd5b341561006657600080fd5b61006e6100d5565b60405190815260200160405180910390f35b341561008b57600080fd5b61006e600160a060020a03600435166100db565b34156100aa57600080fd5b6100c1600160a060020a03600435166024356100f6565b604051901515815260200160405180910390f35b60005481565b600160a060020a031660009081526001602052604090205490565b6000600160a060020a038316151561010d57600080fd5b600160a060020a033316600090815260016020526040902054610136908363ffffffff6101cc16565b600160a060020a03338116600090815260016020526040808220939093559085168152205461016b908363ffffffff6101de16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b6000828211156101d857fe5b50900390565b6000828201838110156101ed57fe5b93925050505600a165627a7a72305820c5161f736c374e2ed9cc115ea11244891bff4e5d2f23fd90aebf778527299cd40029", "deployedBytecode": "0x6060604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166318160ddd811461005b57806370a0823114610080578063a9059cbb1461009f575b600080fd5b341561006657600080fd5b61006e6100d5565b60405190815260200160405180910390f35b341561008b57600080fd5b61006e600160a060020a03600435166100db565b34156100aa57600080fd5b6100c1600160a060020a03600435166024356100f6565b604051901515815260200160405180910390f35b60005481565b600160a060020a031660009081526001602052604090205490565b6000600160a060020a038316151561010d57600080fd5b600160a060020a033316600090815260016020526040902054610136908363ffffffff6101cc16565b600160a060020a03338116600090815260016020526040808220939093559085168152205461016b908363ffffffff6101de16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b6000828211156101d857fe5b50900390565b6000828201838110156101ed57fe5b93925050505600a165627a7a72305820c5161f736c374e2ed9cc115ea11244891bff4e5d2f23fd90aebf778527299cd40029", "sourceMap": "177:910:22:-;;;;;;;;;;;;;;;;;", "deployedSourceMap": "177:910:22:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;179:26:25;;;;;;;;;;;;;;;;;;;;;;;;;;;973:111:22;;;;;;;;;;-1:-1:-1;;;;;973:111:22;;;;;437:334;;;;;;;;;;-1:-1:-1;;;;;437:334:22;;;;;;;;;;;;;;;;;;;;;;;;179:26:25;;;;:::o;973:111:22:-;-1:-1:-1;;;;;1063:16:22;1033:15;1063:16;;;:8;:16;;;;;;;973:111::o;437:334::-;500:4;-1:-1:-1;;;;;520:17:22;;;;512:26;;;;;;-1:-1:-1;;;;;640:10:22;631:20;;;;;:8;:20;;;;;;:32;;656:6;631:32;:24;:32;:::i;:::-;-1:-1:-1;;;;;617:10:22;608:20;;;;;;:8;:20;;;;;;:55;;;;685:13;;;;;;;:25;;703:6;685:25;:17;:25;:::i;:::-;-1:-1:-1;;;;;669:13:22;;;;;;;:8;:13;;;;;;;:41;;;;:13;725:10;716:33;;;;;;742:6;;716:33;;;;;;;;;;;;;-1:-1:-1;762:4:22;437:334;;;;:::o;562:114:20:-;624:7;646:6;;;;639:14;;;;-1:-1:-1;666:5:20;;;562:114::o;680:133::-;742:7;769:5;;;787:6;;;;780:14;;;;807:1;680:133;-1:-1:-1;;;680:133:20:o", "source": "pragma solidity ^0.4.11;\n\n\nimport './ERC20Basic.sol';\nimport '../math/SafeMath.sol';\n\n\n/**\n * @title Basic token\n * @dev Basic version of StandardToken, with no allowances.\n */\ncontract BasicToken is ERC20Basic {\n using SafeMath for uint256;\n\n mapping(address => uint256) balances;\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 require(_to != address(0));\n\n // SafeMath.sub will throw if there is not enough balance.\n balances[msg.sender] = balances[msg.sender].sub(_value);\n balances[_to] = balances[_to].add(_value);\n Transfer(msg.sender, _to, _value);\n return true;\n }\n\n /**\n * @dev Gets the balance of the specified address.\n * @param _owner The address to query the the balance of.\n * @return An uint256 representing the amount owned by the passed address.\n */\n function balanceOf(address _owner) public constant returns (uint256 balance) {\n return balances[_owner];\n }\n\n}\n", "sourcePath": "zeppelin-solidity/contracts/token/BasicToken.sol", "ast": { "attributes": { "absolutePath": "zeppelin-solidity/contracts/token/BasicToken.sol", "exportedSymbols": { "BasicToken": [ 2780 ] } }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.4", ".11" ] }, "id": 2705, "name": "PragmaDirective", "src": "0:24:22" }, { "attributes": { "SourceUnit": 2905, "absolutePath": "zeppelin-solidity/contracts/token/ERC20Basic.sol", "file": "./ERC20Basic.sol", "scope": 2781, "symbolAliases": [ null ], "unitAlias": "" }, "id": 2706, "name": "ImportDirective", "src": "27:26:22" }, { "attributes": { "SourceUnit": 2648, "absolutePath": "zeppelin-solidity/contracts/math/SafeMath.sol", "file": "../math/SafeMath.sol", "scope": 2781, "symbolAliases": [ null ], "unitAlias": "" }, "id": 2707, "name": "ImportDirective", "src": "54:30:22" }, { "attributes": { "contractDependencies": [ 2904 ], "contractKind": "contract", "documentation": "@title Basic token\n@dev Basic version of StandardToken, with no allowances.", "fullyImplemented": true, "linearizedBaseContracts": [ 2780, 2904 ], "name": "BasicToken", "scope": 2781 }, "children": [ { "attributes": { "arguments": [ null ] }, "children": [ { "attributes": { "contractScope": null, "name": "ERC20Basic", "referencedDeclaration": 2904, "type": "contract ERC20Basic" }, "id": 2708, "name": "UserDefinedTypeName", "src": "200:10:22" } ], "id": 2709, "name": "InheritanceSpecifier", "src": "200:10:22" }, { "children": [ { "attributes": { "contractScope": null, "name": "SafeMath", "referencedDeclaration": 2647, "type": "library SafeMath" }, "id": 2710, "name": "UserDefinedTypeName", "src": "221:8:22" }, { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2711, "name": "ElementaryTypeName", "src": "234:7:22" } ], "id": 2712, "name": "UsingForDirective", "src": "215:27:22" }, { "attributes": { "constant": false, "name": "balances", "scope": 2780, "stateVariable": true, "storageLocation": "default", "type": "mapping(address => uint256)", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "type": "mapping(address => uint256)" }, "children": [ { "attributes": { "name": "address", "type": "address" }, "id": 2713, "name": "ElementaryTypeName", "src": "254:7:22" }, { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2714, "name": "ElementaryTypeName", "src": "265:7:22" } ], "id": 2715, "name": "Mapping", "src": "246:27:22" } ], "id": 2716, "name": "VariableDeclaration", "src": "246:36:22" }, { "attributes": { "constant": false, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "transfer", "payable": false, "scope": 2780, "stateMutability": "nonpayable", "superFunction": 2895, "visibility": "public" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "_to", "scope": 2767, "stateVariable": false, "storageLocation": "default", "type": "address", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "address", "type": "address" }, "id": 2717, "name": "ElementaryTypeName", "src": "455:7:22" } ], "id": 2718, "name": "VariableDeclaration", "src": "455:11:22" }, { "attributes": { "constant": false, "name": "_value", "scope": 2767, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2719, "name": "ElementaryTypeName", "src": "468:7:22" } ], "id": 2720, "name": "VariableDeclaration", "src": "468:14:22" } ], "id": 2721, "name": "ParameterList", "src": "454:29:22" }, { "children": [ { "attributes": { "constant": false, "name": "", "scope": 2767, "stateVariable": false, "storageLocation": "default", "type": "bool", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "bool", "type": "bool" }, "id": 2722, "name": "ElementaryTypeName", "src": "500:4:22" } ], "id": 2723, "name": "VariableDeclaration", "src": "500:4:22" } ], "id": 2724, "name": "ParameterList", "src": "499:6:22" }, { "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": 3241, "type": "function (bool) pure", "value": "require" }, "id": 2725, "name": "Identifier", "src": "512:7:22" }, { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "!=", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2718, "type": "address", "value": "_to" }, "id": 2726, "name": "Identifier", "src": "520:3:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": true, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "address", "type_conversion": true }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "type": "type(address)", "value": "address" }, "id": 2727, "name": "ElementaryTypeNameExpression", "src": "527:7:22" }, { "attributes": { "argumentTypes": null, "hexvalue": "30", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "number", "type": "int_const 0", "value": "0" }, "id": 2728, "name": "Literal", "src": "535:1:22" } ], "id": 2729, "name": "FunctionCall", "src": "527:10:22" } ], "id": 2730, "name": "BinaryOperation", "src": "520:17:22" } ], "id": 2731, "name": "FunctionCall", "src": "512:26:22" } ], "id": 2732, "name": "ExpressionStatement", "src": "512:26:22" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2716, "type": "mapping(address => uint256)", "value": "balances" }, "id": 2733, "name": "Identifier", "src": "608:8:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "sender", "referencedDeclaration": null, "type": "address" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 3238, "type": "msg", "value": "msg" }, "id": 2734, "name": "Identifier", "src": "617:3:22" } ], "id": 2735, "name": "MemberAccess", "src": "617:10:22" } ], "id": 2736, "name": "IndexAccess", "src": "608:20:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "uint256", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "sub", "referencedDeclaration": 2622, "type": "function (uint256,uint256) view returns (uint256)" }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2716, "type": "mapping(address => uint256)", "value": "balances" }, "id": 2737, "name": "Identifier", "src": "631:8:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "sender", "referencedDeclaration": null, "type": "address" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 3238, "type": "msg", "value": "msg" }, "id": 2738, "name": "Identifier", "src": "640:3:22" } ], "id": 2739, "name": "MemberAccess", "src": "640:10:22" } ], "id": 2740, "name": "IndexAccess", "src": "631:20:22" } ], "id": 2741, "name": "MemberAccess", "src": "631:24:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2720, "type": "uint256", "value": "_value" }, "id": 2742, "name": "Identifier", "src": "656:6:22" } ], "id": 2743, "name": "FunctionCall", "src": "631:32:22" } ], "id": 2744, "name": "Assignment", "src": "608:55:22" } ], "id": 2745, "name": "ExpressionStatement", "src": "608:55:22" }, { "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "=", "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2716, "type": "mapping(address => uint256)", "value": "balances" }, "id": 2746, "name": "Identifier", "src": "669:8:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2718, "type": "address", "value": "_to" }, "id": 2747, "name": "Identifier", "src": "678:3:22" } ], "id": 2748, "name": "IndexAccess", "src": "669:13:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "type": "uint256", "type_conversion": false }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "add", "referencedDeclaration": 2646, "type": "function (uint256,uint256) view returns (uint256)" }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2716, "type": "mapping(address => uint256)", "value": "balances" }, "id": 2749, "name": "Identifier", "src": "685:8:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2718, "type": "address", "value": "_to" }, "id": 2750, "name": "Identifier", "src": "694:3:22" } ], "id": 2751, "name": "IndexAccess", "src": "685:13:22" } ], "id": 2752, "name": "MemberAccess", "src": "685:17:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2720, "type": "uint256", "value": "_value" }, "id": 2753, "name": "Identifier", "src": "703:6:22" } ], "id": 2754, "name": "FunctionCall", "src": "685:25:22" } ], "id": 2755, "name": "Assignment", "src": "669:41:22" } ], "id": 2756, "name": "ExpressionStatement", "src": "669:41:22" }, { "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_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "overloadedDeclarations": [ null ], "referencedDeclaration": 2903, "type": "function (address,address,uint256)", "value": "Transfer" }, "id": 2757, "name": "Identifier", "src": "716:8:22" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "member_name": "sender", "referencedDeclaration": null, "type": "address" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 3238, "type": "msg", "value": "msg" }, "id": 2758, "name": "Identifier", "src": "725:3:22" } ], "id": 2759, "name": "MemberAccess", "src": "725:10:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2718, "type": "address", "value": "_to" }, "id": 2760, "name": "Identifier", "src": "737:3:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2720, "type": "uint256", "value": "_value" }, "id": 2761, "name": "Identifier", "src": "742:6:22" } ], "id": 2762, "name": "FunctionCall", "src": "716:33:22" } ], "id": 2763, "name": "ExpressionStatement", "src": "716:33:22" }, { "attributes": { "functionReturnParameters": 2724 }, "children": [ { "attributes": { "argumentTypes": null, "hexvalue": "74727565", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "bool", "type": "bool", "value": "true" }, "id": 2764, "name": "Literal", "src": "762:4:22" } ], "id": 2765, "name": "Return", "src": "755:11:22" } ], "id": 2766, "name": "Block", "src": "506:265:22" } ], "id": 2767, "name": "FunctionDefinition", "src": "437:334:22" }, { "attributes": { "constant": true, "implemented": true, "isConstructor": false, "modifiers": [ null ], "name": "balanceOf", "payable": false, "scope": 2780, "stateMutability": "view", "superFunction": 2886, "visibility": "public" }, "children": [ { "children": [ { "attributes": { "constant": false, "name": "_owner", "scope": 2779, "stateVariable": false, "storageLocation": "default", "type": "address", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "address", "type": "address" }, "id": 2768, "name": "ElementaryTypeName", "src": "992:7:22" } ], "id": 2769, "name": "VariableDeclaration", "src": "992:14:22" } ], "id": 2770, "name": "ParameterList", "src": "991:16:22" }, { "children": [ { "attributes": { "constant": false, "name": "balance", "scope": 2779, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint256", "type": "uint256" }, "id": 2771, "name": "ElementaryTypeName", "src": "1033:7:22" } ], "id": 2772, "name": "VariableDeclaration", "src": "1033:15:22" } ], "id": 2773, "name": "ParameterList", "src": "1032:17:22" }, { "children": [ { "attributes": { "functionReturnParameters": 2773 }, "children": [ { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "type": "uint256" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2716, "type": "mapping(address => uint256)", "value": "balances" }, "id": 2774, "name": "Identifier", "src": "1063:8:22" }, { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 2769, "type": "address", "value": "_owner" }, "id": 2775, "name": "Identifier", "src": "1072:6:22" } ], "id": 2776, "name": "IndexAccess", "src": "1063:16:22" } ], "id": 2777, "name": "Return", "src": "1056:23:22" } ], "id": 2778, "name": "Block", "src": "1050:34:22" } ], "id": 2779, "name": "FunctionDefinition", "src": "973:111:22" } ], "id": 2780, "name": "ContractDefinition", "src": "177:910:22" } ], "id": 2781, "name": "SourceUnit", "src": "0:1088:22" }, "compiler": { "name": "solc", "version": "0.4.18+commit.9cf6e910.Emscripten.clang" }, "networks": {}, "schemaVersion": "1.0.1", "updatedAt": "2018-03-26T15:46:12.495Z" }