@netvote/elections-solidity
Version:
Elections Contracts
827 lines • 31.9 kB
JSON
{
"contractName": "Migrations",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "new_address",
"type": "address"
}
],
"name": "upgrade",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "last_completed_migration",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "completed",
"type": "uint256"
}
],
"name": "setCompleted",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
],
"bytecode": "0x6060604052341561000f57600080fd5b60008054600160a060020a033316600160a060020a03199091161790556101e78061003b6000396000f3006060604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f0108114610066578063445df0ac146100875780638da5cb5b146100ac578063fdacd576146100db575b600080fd5b341561007157600080fd5b610085600160a060020a03600435166100f1565b005b341561009257600080fd5b61009a610186565b60405190815260200160405180910390f35b34156100b757600080fd5b6100bf61018c565b604051600160a060020a03909116815260200160405180910390f35b34156100e657600080fd5b61008560043561019b565b6000805433600160a060020a03908116911614156101825781905080600160a060020a031663fdacd5766001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b151561016d57600080fd5b6102c65a03f1151561017e57600080fd5b5050505b5050565b60015481565b600054600160a060020a031681565b60005433600160a060020a03908116911614156101b85760018190555b505600a165627a7a72305820a4cafe4fe74a900f50e97ef4b33db22a5f6bdab2e9212bb6efdccfb8f4e70e540029",
"deployedBytecode": "0x6060604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f0108114610066578063445df0ac146100875780638da5cb5b146100ac578063fdacd576146100db575b600080fd5b341561007157600080fd5b610085600160a060020a03600435166100f1565b005b341561009257600080fd5b61009a610186565b60405190815260200160405180910390f35b34156100b757600080fd5b6100bf61018c565b604051600160a060020a03909116815260200160405180910390f35b34156100e657600080fd5b61008560043561019b565b6000805433600160a060020a03908116911614156101825781905080600160a060020a031663fdacd5766001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b151561016d57600080fd5b6102c65a03f1151561017e57600080fd5b5050505b5050565b60015481565b600054600160a060020a031681565b60005433600160a060020a03908116911614156101b85760018190555b505600a165627a7a72305820a4cafe4fe74a900f50e97ef4b33db22a5f6bdab2e9212bb6efdccfb8f4e70e540029",
"sourceMap": "894:488:0:-;;;1046:58;;;;;;;;1081:5;:18;;-1:-1:-1;;;;;1089:10:0;1081:18;-1:-1:-1;;;;;;1081:18:0;;;;;;894:488;;;;;;",
"deployedSourceMap": "894:488:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1215:165;;;;;;;;;;-1:-1:-1;;;;;1215:165:0;;;;;;;942:36;;;;;;;;;;;;;;;;;;;;;;;;;;;918:20;;;;;;;;;;;;;;;-1:-1:-1;;;;;918:20:0;;;;;;;;;;;;;;1108:103;;;;;;;;;;;;;;1215:165;1277:19;1029:5;;1015:10;-1:-1:-1;;;;;1015:19:0;;;1029:5;;1015:19;1011:26;;;1310:11;1277:45;;1328:8;-1:-1:-1;;;;;1328:21:0;;1350:24;;1328:47;;;;;;;;;;;;;;;;;;-1:-1:-1;1328:47:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1011:26;1215:165;;:::o;942:36::-;;;;:::o;918:20::-;;;-1:-1:-1;;;;;918:20:0;;:::o;1108:103::-;1029:5;;1015:10;-1:-1:-1;;;;;1015:19:0;;;1029:5;;1015:19;1011:26;;;1170:24;:36;;;1011:26;1108:103;:::o",
"source": "// ------------------------------------------------------------------------------\n// This file is part of netvote.\n//\n// netvote is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// netvote is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with solidity. If not, see <http://www.gnu.org/licenses/>\n//\n// (c) 2017 netvote contributors.\n//------------------------------------------------------------------------------\n\npragma solidity ^0.4.17;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n",
"sourcePath": "/Users/slanders/netvote/elections-solidity/contracts/Migrations.sol",
"ast": {
"attributes": {
"absolutePath": "/Users/slanders/netvote/elections-solidity/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
56
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".17"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "868:24:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
56
],
"name": "Migrations",
"scope": 57
},
"children": [
{
"attributes": {
"constant": false,
"name": "owner",
"scope": 56,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "918:7:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "918:20:0"
},
{
"attributes": {
"constant": false,
"name": "last_completed_migration",
"scope": 56,
"stateVariable": true,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "942:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "942:36:0"
},
{
"attributes": {
"name": "restricted",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 6,
"name": "ParameterList",
"src": "1002:2:0"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"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": 3449,
"type": "msg",
"value": "msg"
},
"id": 7,
"name": "Identifier",
"src": "1015:3:0"
}
],
"id": 8,
"name": "MemberAccess",
"src": "1015:10:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "address",
"value": "owner"
},
"id": 9,
"name": "Identifier",
"src": "1029:5:0"
}
],
"id": 10,
"name": "BinaryOperation",
"src": "1015:19:0"
},
{
"id": 11,
"name": "PlaceholderStatement",
"src": "1036:1:0"
}
],
"id": 12,
"name": "IfStatement",
"src": "1011:26:0"
}
],
"id": 13,
"name": "Block",
"src": "1005:37:0"
}
],
"id": 14,
"name": "ModifierDefinition",
"src": "983:59:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": true,
"modifiers": [
null
],
"name": "Migrations",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 15,
"name": "ParameterList",
"src": "1065:2:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 16,
"name": "ParameterList",
"src": "1075:0:0"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "address",
"value": "owner"
},
"id": 17,
"name": "Identifier",
"src": "1081:5:0"
},
{
"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": 3449,
"type": "msg",
"value": "msg"
},
"id": 18,
"name": "Identifier",
"src": "1089:3:0"
}
],
"id": 19,
"name": "MemberAccess",
"src": "1089:10:0"
}
],
"id": 20,
"name": "Assignment",
"src": "1081:18:0"
}
],
"id": 21,
"name": "ExpressionStatement",
"src": "1081:18:0"
}
],
"id": 22,
"name": "Block",
"src": "1075:29:0"
}
],
"id": 23,
"name": "FunctionDefinition",
"src": "1046:58:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "setCompleted",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "completed",
"scope": 35,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 24,
"name": "ElementaryTypeName",
"src": "1130:4:0"
}
],
"id": 25,
"name": "VariableDeclaration",
"src": "1130:14:0"
}
],
"id": 26,
"name": "ParameterList",
"src": "1129:16:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 29,
"name": "ParameterList",
"src": "1164:0:0"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 14,
"type": "modifier ()",
"value": "restricted"
},
"id": 27,
"name": "Identifier",
"src": "1153:10:0"
}
],
"id": 28,
"name": "ModifierInvocation",
"src": "1153:10:0"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 30,
"name": "Identifier",
"src": "1170:24:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 25,
"type": "uint256",
"value": "completed"
},
"id": 31,
"name": "Identifier",
"src": "1197:9:0"
}
],
"id": 32,
"name": "Assignment",
"src": "1170:36:0"
}
],
"id": 33,
"name": "ExpressionStatement",
"src": "1170:36:0"
}
],
"id": 34,
"name": "Block",
"src": "1164:47:0"
}
],
"id": 35,
"name": "FunctionDefinition",
"src": "1108:103:0"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "upgrade",
"payable": false,
"scope": 56,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "new_address",
"scope": 55,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 36,
"name": "ElementaryTypeName",
"src": "1232:7:0"
}
],
"id": 37,
"name": "VariableDeclaration",
"src": "1232:19:0"
}
],
"id": 38,
"name": "ParameterList",
"src": "1231:21:0"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 41,
"name": "ParameterList",
"src": "1271:0:0"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 14,
"type": "modifier ()",
"value": "restricted"
},
"id": 39,
"name": "Identifier",
"src": "1260:10:0"
}
],
"id": 40,
"name": "ModifierInvocation",
"src": "1260:10:0"
},
{
"children": [
{
"attributes": {
"assignments": [
43
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "upgraded",
"scope": 55,
"stateVariable": false,
"storageLocation": "default",
"type": "contract Migrations",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"contractScope": null,
"name": "Migrations",
"referencedDeclaration": 56,
"type": "contract Migrations"
},
"id": 42,
"name": "UserDefinedTypeName",
"src": "1277:10:0"
}
],
"id": 43,
"name": "VariableDeclaration",
"src": "1277:19:0"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "contract Migrations",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 56,
"type": "type(contract Migrations)",
"value": "Migrations"
},
"id": 44,
"name": "Identifier",
"src": "1299:10:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 37,
"type": "address",
"value": "new_address"
},
"id": 45,
"name": "Identifier",
"src": "1310:11:0"
}
],
"id": 46,
"name": "FunctionCall",
"src": "1299:23:0"
}
],
"id": 47,
"name": "VariableDeclarationStatement",
"src": "1277:45:0"
},
{
"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_uint256",
"typeString": "uint256"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "setCompleted",
"referencedDeclaration": 35,
"type": "function (uint256) external"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 43,
"type": "contract Migrations",
"value": "upgraded"
},
"id": 48,
"name": "Identifier",
"src": "1328:8:0"
}
],
"id": 50,
"name": "MemberAccess",
"src": "1328:21:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 51,
"name": "Identifier",
"src": "1350:24:0"
}
],
"id": 52,
"name": "FunctionCall",
"src": "1328:47:0"
}
],
"id": 53,
"name": "ExpressionStatement",
"src": "1328:47:0"
}
],
"id": 54,
"name": "Block",
"src": "1271:109:0"
}
],
"id": 55,
"name": "FunctionDefinition",
"src": "1215:165:0"
}
],
"id": 56,
"name": "ContractDefinition",
"src": "894:488:0"
}
],
"id": 57,
"name": "SourceUnit",
"src": "868:515:0"
},
"compiler": {
"name": "solc",
"version": "0.4.18+commit.9cf6e910.Emscripten.clang"
},
"networks": {
"3": {
"events": {},
"links": {},
"address": "0xb6aa0bca9489d796237d21c11e871e66530f23e4"
}
},
"schemaVersion": "1.0.1",
"updatedAt": "2018-03-26T15:58:05.151Z"
}