@netvote/elections-solidity
Version:
Elections Contracts
1,085 lines (1,084 loc) • 51 kB
JSON
{
"contractName": "KeyHolder",
"abi": [
{
"constant": false,
"inputs": [],
"name": "activate",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "removeAdmin",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "isAdmin",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "electionPhase",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "abort",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "close",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "privateKey",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "removeSelf",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "publicKey",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "key",
"type": "string"
}
],
"name": "setPublicKey",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "addAdmin",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isLocked",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "unlock",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isClosed",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "key",
"type": "string"
}
],
"name": "setPrivateKey",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "checkConfig",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "lock",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "revealerAddr",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [],
"name": "KeyReleased",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Closed",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Activated",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Aborted",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Locked",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Unlocked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
}
],
"bytecode": "0x60606040526002805461ffff19169055341561001a57600080fd5b604051602080610ae98339810160405280805160008054600160a060020a03338116600160a060020a031990921691909117909155600280549190921662010000026201000060b060020a03199091161790555050610a6b8061007e6000396000f3006060604052600436106101065763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630f15f4c0811461010b5780631785f53c1461012057806324d7806c1461013f578063265050b61461017257806335a063b4146101a957806343d726d6146101bc57806349da5a0f146101cf5780635e898dac1461025957806363ffab311461026c5780636f6fc0771461027f57806370480275146102d05780638da5cb5b146102ef578063a4e2d6341461031e578063a69df4b514610331578063c2b6b58c14610344578063e0d4f01714610357578063f098fe47146103a8578063f2fde38b146103bb578063f83d08ba146103da575b600080fd5b341561011657600080fd5b61011e6103ed565b005b341561012b57600080fd5b61011e600160a060020a0360043516610486565b341561014a57600080fd5b61015e600160a060020a03600435166104c2565b604051901515815260200160405180910390f35b341561017d57600080fd5b610185610511565b6040518082600381111561019557fe5b60ff16815260200191505060405180910390f35b34156101b457600080fd5b61011e61051f565b34156101c757600080fd5b61011e610570565b34156101da57600080fd5b6101e26105f6565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561021e578082015183820152602001610206565b50505050905090810190601f16801561024b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026457600080fd5b61011e610694565b341561027757600080fd5b6101e26106ca565b341561028a57600080fd5b61011e60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061073595505050505050565b34156102db57600080fd5b61011e600160a060020a036004351661076d565b34156102fa57600080fd5b6103026107af565b604051600160a060020a03909116815260200160405180910390f35b341561032957600080fd5b61015e6107be565b341561033c57600080fd5b61011e6107c8565b341561034f57600080fd5b61015e610825565b341561036257600080fd5b61011e60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061084495505050505050565b34156103b357600080fd5b61015e6108a8565b34156103c657600080fd5b61011e600160a060020a03600435166108ad565b34156103e557600080fd5b61011e610948565b6103f56107be565b15801561041757506000600254610100900460ff16600381111561041557fe5b145b151561042257600080fd5b61042b336104c2565b151561043657600080fd5b61043e6108a8565b151561044957600080fd5b6002805461ff0019166101001790557fed1cd0670ee0c0017f550451a038818c696d0b6a9d6ce5b369e44275573cf9b060405160405180910390a1565b60005433600160a060020a039081169116146104a157600080fd5b600160a060020a03166000908152600160205260409020805460ff19169055565b6000600160a060020a0382161580159061050b5750600054600160a060020a038381169116148061050b5750600160a060020a03821660009081526001602052604090205460ff165b92915050565b600254610100900460ff1681565b610528336104c2565b151561053357600080fd5b6002805461ff0019166103001790557f72c874aeff0b183a56e2b79c71b46e1aed4dee5e09862134b8821ba2fddbf8bf60405160405180910390a1565b6105786107be565b15801561059a57506001600254610100900460ff16600381111561059857fe5b145b15156105a557600080fd5b6105ae336104c2565b15156105b957600080fd5b6002805461ff0019166102001790557f1cdde67b72a90f19919ac732a437ac2f7a10fc128d28c2a6e525d89ce5cd9d3a60405160405180910390a1565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068c5780601f106106615761010080835404028352916020019161068c565b820191906000526020600020905b81548152906001019060200180831161066f57829003601f168201915b505050505081565b61069d336104c2565b15156106a857600080fd5b600160a060020a0333166000908152600160205260409020805460ff19169055565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068c5780601f106106615761010080835404028352916020019161068c565b60025433600160a060020a0390811662010000909204161461075657600080fd5b60038180516107699291602001906109a7565b5050565b60005433600160a060020a0390811691161461078857600080fd5b600160a060020a03166000908152600160208190526040909120805460ff19169091179055565b600054600160a060020a031681565b60025460ff165b90565b6107d1336104c2565b15156107dc57600080fd5b60025460ff1615156107ed57600080fd5b6002805460ff191690557f19aad37188a1d3921e29eb3c66acf43d81975e107cb650d58cca878627955fd660405160405180910390a1565b600060028054610100900460ff16600381111561083e57fe5b14905090565b60025433600160a060020a0390811662010000909204161461086557600080fd5b60048180516108789291602001906109a7565b507ff9d8c4f7f692590eaf6d41d6160024ffe0ce509fa752efcf47543eb851869cfb60405160405180910390a150565b600190565b60005433600160a060020a039081169116146108c857600080fd5b600160a060020a03811615156108dd57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b610951336104c2565b151561095c57600080fd5b60025460ff161561096c57600080fd5b6002805460ff191660011790557f0f2e5b6c72c6a4491efd919a9f9a409f324ef0708c11ee57d410c2cb06c0992b60405160405180910390a1565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109e857805160ff1916838001178555610a15565b82800160010185558215610a15579182015b82811115610a155782518255916020019190600101906109fa565b50610a21929150610a25565b5090565b6107c591905b80821115610a215760008155600101610a2b5600a165627a7a72305820047eb60a1011304a3cbc81c2e74b1707cceba54627b83d030ad20c1089a0663c0029",
"deployedBytecode": "0x6060604052600436106101065763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630f15f4c0811461010b5780631785f53c1461012057806324d7806c1461013f578063265050b61461017257806335a063b4146101a957806343d726d6146101bc57806349da5a0f146101cf5780635e898dac1461025957806363ffab311461026c5780636f6fc0771461027f57806370480275146102d05780638da5cb5b146102ef578063a4e2d6341461031e578063a69df4b514610331578063c2b6b58c14610344578063e0d4f01714610357578063f098fe47146103a8578063f2fde38b146103bb578063f83d08ba146103da575b600080fd5b341561011657600080fd5b61011e6103ed565b005b341561012b57600080fd5b61011e600160a060020a0360043516610486565b341561014a57600080fd5b61015e600160a060020a03600435166104c2565b604051901515815260200160405180910390f35b341561017d57600080fd5b610185610511565b6040518082600381111561019557fe5b60ff16815260200191505060405180910390f35b34156101b457600080fd5b61011e61051f565b34156101c757600080fd5b61011e610570565b34156101da57600080fd5b6101e26105f6565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561021e578082015183820152602001610206565b50505050905090810190601f16801561024b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026457600080fd5b61011e610694565b341561027757600080fd5b6101e26106ca565b341561028a57600080fd5b61011e60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061073595505050505050565b34156102db57600080fd5b61011e600160a060020a036004351661076d565b34156102fa57600080fd5b6103026107af565b604051600160a060020a03909116815260200160405180910390f35b341561032957600080fd5b61015e6107be565b341561033c57600080fd5b61011e6107c8565b341561034f57600080fd5b61015e610825565b341561036257600080fd5b61011e60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061084495505050505050565b34156103b357600080fd5b61015e6108a8565b34156103c657600080fd5b61011e600160a060020a03600435166108ad565b34156103e557600080fd5b61011e610948565b6103f56107be565b15801561041757506000600254610100900460ff16600381111561041557fe5b145b151561042257600080fd5b61042b336104c2565b151561043657600080fd5b61043e6108a8565b151561044957600080fd5b6002805461ff0019166101001790557fed1cd0670ee0c0017f550451a038818c696d0b6a9d6ce5b369e44275573cf9b060405160405180910390a1565b60005433600160a060020a039081169116146104a157600080fd5b600160a060020a03166000908152600160205260409020805460ff19169055565b6000600160a060020a0382161580159061050b5750600054600160a060020a038381169116148061050b5750600160a060020a03821660009081526001602052604090205460ff165b92915050565b600254610100900460ff1681565b610528336104c2565b151561053357600080fd5b6002805461ff0019166103001790557f72c874aeff0b183a56e2b79c71b46e1aed4dee5e09862134b8821ba2fddbf8bf60405160405180910390a1565b6105786107be565b15801561059a57506001600254610100900460ff16600381111561059857fe5b145b15156105a557600080fd5b6105ae336104c2565b15156105b957600080fd5b6002805461ff0019166102001790557f1cdde67b72a90f19919ac732a437ac2f7a10fc128d28c2a6e525d89ce5cd9d3a60405160405180910390a1565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068c5780601f106106615761010080835404028352916020019161068c565b820191906000526020600020905b81548152906001019060200180831161066f57829003601f168201915b505050505081565b61069d336104c2565b15156106a857600080fd5b600160a060020a0333166000908152600160205260409020805460ff19169055565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068c5780601f106106615761010080835404028352916020019161068c565b60025433600160a060020a0390811662010000909204161461075657600080fd5b60038180516107699291602001906109a7565b5050565b60005433600160a060020a0390811691161461078857600080fd5b600160a060020a03166000908152600160208190526040909120805460ff19169091179055565b600054600160a060020a031681565b60025460ff165b90565b6107d1336104c2565b15156107dc57600080fd5b60025460ff1615156107ed57600080fd5b6002805460ff191690557f19aad37188a1d3921e29eb3c66acf43d81975e107cb650d58cca878627955fd660405160405180910390a1565b600060028054610100900460ff16600381111561083e57fe5b14905090565b60025433600160a060020a0390811662010000909204161461086557600080fd5b60048180516108789291602001906109a7565b507ff9d8c4f7f692590eaf6d41d6160024ffe0ce509fa752efcf47543eb851869cfb60405160405180910390a150565b600190565b60005433600160a060020a039081169116146108c857600080fd5b600160a060020a03811615156108dd57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b610951336104c2565b151561095c57600080fd5b60025460ff161561096c57600080fd5b6002805460ff191660011790557f0f2e5b6c72c6a4491efd919a9f9a409f324ef0708c11ee57d410c2cb06c0992b60405160405180910390a1565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109e857805160ff1916838001178555610a15565b82800160010185558215610a15579182015b82811115610a155782518255916020019190600101906109fa565b50610a21929150610a25565b5090565b6107c591905b80821115610a215760008155600101610a2b5600a165627a7a72305820047eb60a1011304a3cbc81c2e74b1707cceba54627b83d030ad20c1089a0663c0029",
"sourceMap": "1172:714:11:-;;;1183:22:16;;;-1:-1:-1;;1326:59:15;;;1327:88:11;;;;;;;;;;;;;;;;;;;;;;494:5:21;:18;;-1:-1:-1;;;;;502:10:21;494:18;;-1:-1:-1;;;;;;494:18:21;;;;;;;;;;1385:8:11;:23;;;;;;;;-1:-1:-1;;;;;;1385:23:11;;;;;;-1:-1:-1;;1172:714:11;;;;;;",
"deployedSourceMap": "1172:714:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2006:148:15;;;;;;;;;;;;;;1460:95:0;;;;;;;;;;-1:-1:-1;;;;;1460:95:0;;;;;1212:145;;;;;;;;;;-1:-1:-1;;;;;1212:145:0;;;;;;;;;;;;;;;;;;;;;;1326:59:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2274:103;;;;;;;;;;;;2160:108;;;;;;;;;;;;1296:24:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;71:3;;;64:6;52:2;45:3;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1561:84:0;;;;;;;;;;;;1267:23:11;;;;;;;;;;;;1595:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1595:86:11;;-1:-1:-1;1595:86:11;;-1:-1:-1;;;;;;1595:86:11;1363:91:0;;;;;;;;;;-1:-1:-1;;;;;1363:91:0;;;;;238:20:21;;;;;;;;;;;;;;;-1:-1:-1;;;;;238:20:21;;;;;;;;;;;;;;1355:84:16;;;;;;;;;;;;1540:92;;;;;;;;;;;;1720:112:15;;;;;;;;;;;;1773:111:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1773:111:11;;-1:-1:-1;1773:111:11;;-1:-1:-1;;;;;;1773:111:11;1838:162:15;;;;;;;;;;;;827:169:21;;;;;;;;;;-1:-1:-1;;;;;827:169:21;;;;;1445:89:16;;;;;;;;;;;;2006:148:15;1529:10;:8;:10::i;:::-;1528:11;:54;;;;-1:-1:-1;1560:22:15;1543:13;;;;;;;:39;;;;;;;;;1528:54;1520:63;;;;;;;;1168:19:0;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;2066:13:15;:11;:13::i;:::-;2058:22;;;;;;;;2090:13;:36;;-1:-1:-1;;2090:36:15;;;;;2136:11;;;;;;;;;;2006:148::o;1460:95:0:-;647:5:21;;633:10;-1:-1:-1;;;;;633:19:21;;;647:5;;633:19;625:28;;;;;;-1:-1:-1;;;;;1522:18:0;1543:5;1522:18;;;:12;:18;;;;;:26;;-1:-1:-1;;1522:26:0;;;1460:95::o;1212:145::-;1268:4;-1:-1:-1;;;;;1291:18:0;;;;;;:59;;-1:-1:-1;1322:5:0;;-1:-1:-1;;;;;1314:13:0;;;1322:5;;1314:13;;:35;;-1:-1:-1;;;;;;1331:18:0;;;;;;:12;:18;;;;;;;;1314:35;1284:66;1212:145;-1:-1:-1;;1212:145:0:o;1326:59:15:-;;;;;;;;;:::o;2274:103::-;1168:19:0;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;2314:13:15;:37;;-1:-1:-1;;2314:37:15;;;;;2361:9;;;;;;;;;;2274:103::o;2160:108::-;1644:10;:8;:10::i;:::-;1643:11;:52;;;;-1:-1:-1;1675:20:15;1658:13;;;;;;;:37;;;;;;;;;1643:52;1635:61;;;;;;;;1168:19:0;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;2223:20:15;2207:36;;-1:-1:-1;;2207:36:15;;;;;2253:8;;;;;;;;;;2160:108::o;1296:24:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1561:84:0:-;1168:19;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;-1:-1:-1;;;;;1619:10:0;1606:24;1633:5;1606:24;;;:12;:24;;;;;:32;;-1:-1:-1;;1606:32:0;;;1561:84::o;1267:23:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1595:86;1476:8;;1462:10;-1:-1:-1;;;;;1462:22:11;;;1476:8;;;;;1462:22;1454:31;;;;;;1659:9;1671:3;;1659:15;;;;;;;;:::i;:::-;;1595:86;:::o;1363:91:0:-;647:5:21;;633:10;-1:-1:-1;;;;;633:19:21;;;647:5;;633:19;625:28;;;;;;-1:-1:-1;;;;;1422:18:0;;;;;1443:4;1422:18;;;;;;;;:25;;-1:-1:-1;;1422:25:0;;;;;;1363:91::o;238:20:21:-;;;-1:-1:-1;;;;;238:20:21;;:::o;1355:84:16:-;1423:9;;;;1355:84;;:::o;1540:92::-;1168:19:0;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;1248:9:16;;;;1240:18;;;;;;;;1588:9;:17;;-1:-1:-1;;1588:17:16;;;1615:10;;;;;;;;;;1540:92::o;1720:112:15:-;1765:4;1805:20;1788:13;;;;;;;:37;;;;;;;;;1781:44;;1720:112;:::o;1773:111:11:-;1476:8;;1462:10;-1:-1:-1;;;;;1462:22:11;;;1476:8;;;;;1462:22;1454:31;;;;;;1838:10;1851:3;;1838:16;;;;;;;;:::i;:::-;;1864:13;;;;;;;;;;1773:111;:::o;1838:162:15:-;1989:4;1838:162;:::o;827:169:21:-;647:5;;633:10;-1:-1:-1;;;;;633:19:21;;;647:5;;633:19;625:28;;;;;;-1:-1:-1;;;;;903:22:21;;;;895:31;;;;;;953:5;;-1:-1:-1;;;;;932:37:21;;;;953:5;932:37;;;;;;;;;;975:5;:16;;-1:-1:-1;;975:16:21;-1:-1:-1;;;;;975:16:21;;;;;;;;;;827:169::o;1445:89:16:-;1168:19:0;1176:10;1168:7;:19::i;:::-;1160:28;;;;;;;;1321:9:16;;;;1320:10;1312:19;;;;;;1493:9;:16;;-1:-1:-1;;1493:16:16;1505:4;1493:16;;;1519:8;;;;;;;;;;1445:89::o;1172:714:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1172:714:11;;;-1:-1:-1;1172:714:11;:::i;:::-;;;:::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\nimport \"../state/ElectionPhaseable.sol\";\n\n\n/**\n * @title KeyHolder\n * @dev allows storage of a public and private key for encryption/decryption.\n * If symmetric encryption is used, simply use the private key field upon reveal.\n * Only the revealer address may reveal a key.\n */\ncontract KeyHolder is ElectionPhaseable {\n\n event KeyReleased();\n\n address revealer;\n string public publicKey;\n string public privateKey;\n\n function KeyHolder(address revealerAddr) public {\n revealer = revealerAddr;\n }\n\n modifier onlyRevealer(){\n require(msg.sender == revealer);\n _;\n }\n\n //TODO: instead of from admin, this should be only key writer (specified address)\n function setPublicKey(string key) public onlyRevealer {\n publicKey = key;\n }\n\n //TODO: instead of from admin, this should be only key writer (specified address)\n function setPrivateKey(string key) public onlyRevealer {\n privateKey = key;\n KeyReleased();\n }\n}",
"sourcePath": "/Users/slanders/netvote/elections-solidity/contracts/encryption/KeyHolder.sol",
"ast": {
"attributes": {
"absolutePath": "/Users/slanders/netvote/elections-solidity/contracts/encryption/KeyHolder.sol",
"exportedSymbols": {
"KeyHolder": [
1542
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.4",
".17"
]
},
"id": 1482,
"name": "PragmaDirective",
"src": "868:24:11"
},
{
"attributes": {
"SourceUnit": 2130,
"absolutePath": "/Users/slanders/netvote/elections-solidity/contracts/state/ElectionPhaseable.sol",
"file": "../state/ElectionPhaseable.sol",
"scope": 1543,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 1483,
"name": "ImportDirective",
"src": "894:40:11"
},
{
"attributes": {
"contractDependencies": [
84,
2129,
2197,
2703
],
"contractKind": "contract",
"documentation": "@title KeyHolder\n@dev allows storage of a public and private key for encryption/decryption.\nIf symmetric encryption is used, simply use the private key field upon reveal.\nOnly the revealer address may reveal a key.",
"fullyImplemented": true,
"linearizedBaseContracts": [
1542,
2129,
2197,
84,
2703
],
"name": "KeyHolder",
"scope": 1543
},
"children": [
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"contractScope": null,
"name": "ElectionPhaseable",
"referencedDeclaration": 2129,
"type": "contract ElectionPhaseable"
},
"id": 1484,
"name": "UserDefinedTypeName",
"src": "1194:17:11"
}
],
"id": 1485,
"name": "InheritanceSpecifier",
"src": "1194:17:11"
},
{
"attributes": {
"anonymous": false,
"name": "KeyReleased"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1486,
"name": "ParameterList",
"src": "1236:2:11"
}
],
"id": 1487,
"name": "EventDefinition",
"src": "1219:20:11"
},
{
"attributes": {
"constant": false,
"name": "revealer",
"scope": 1542,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 1488,
"name": "ElementaryTypeName",
"src": "1245:7:11"
}
],
"id": 1489,
"name": "VariableDeclaration",
"src": "1245:16:11"
},
{
"attributes": {
"constant": false,
"name": "publicKey",
"scope": 1542,
"stateVariable": true,
"storageLocation": "default",
"type": "string storage ref",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "string",
"type": "string storage pointer"
},
"id": 1490,
"name": "ElementaryTypeName",
"src": "1267:6:11"
}
],
"id": 1491,
"name": "VariableDeclaration",
"src": "1267:23:11"
},
{
"attributes": {
"constant": false,
"name": "privateKey",
"scope": 1542,
"stateVariable": true,
"storageLocation": "default",
"type": "string storage ref",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "string",
"type": "string storage pointer"
},
"id": 1492,
"name": "ElementaryTypeName",
"src": "1296:6:11"
}
],
"id": 1493,
"name": "VariableDeclaration",
"src": "1296:24:11"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": true,
"modifiers": [
null
],
"name": "KeyHolder",
"payable": false,
"scope": 1542,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "revealerAddr",
"scope": 1503,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 1494,
"name": "ElementaryTypeName",
"src": "1346:7:11"
}
],
"id": 1495,
"name": "VariableDeclaration",
"src": "1346:20:11"
}
],
"id": 1496,
"name": "ParameterList",
"src": "1345:22:11"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1497,
"name": "ParameterList",
"src": "1375:0:11"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1489,
"type": "address",
"value": "revealer"
},
"id": 1498,
"name": "Identifier",
"src": "1385:8:11"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1495,
"type": "address",
"value": "revealerAddr"
},
"id": 1499,
"name": "Identifier",
"src": "1396:12:11"
}
],
"id": 1500,
"name": "Assignment",
"src": "1385:23:11"
}
],
"id": 1501,
"name": "ExpressionStatement",
"src": "1385:23:11"
}
],
"id": 1502,
"name": "Block",
"src": "1375:40:11"
}
],
"id": 1503,
"name": "FunctionDefinition",
"src": "1327:88:11"
},
{
"attributes": {
"name": "onlyRevealer",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1504,
"name": "ParameterList",
"src": "1442:2:11"
},
{
"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": 1505,
"name": "Identifier",
"src": "1454:7:11"
},
{
"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": 3238,
"type": "msg",
"value": "msg"
},
"id": 1506,
"name": "Identifier",
"src": "1462:3:11"
}
],
"id": 1507,
"name": "MemberAccess",
"src": "1462:10:11"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1489,
"type": "address",
"value": "revealer"
},
"id": 1508,
"name": "Identifier",
"src": "1476:8:11"
}
],
"id": 1509,
"name": "BinaryOperation",
"src": "1462:22:11"
}
],
"id": 1510,
"name": "FunctionCall",
"src": "1454:31:11"
}
],
"id": 1511,
"name": "ExpressionStatement",
"src": "1454:31:11"
},
{
"id": 1512,
"name": "PlaceholderStatement",
"src": "1495:1:11"
}
],
"id": 1513,
"name": "Block",
"src": "1444:59:11"
}
],
"id": 1514,
"name": "ModifierDefinition",
"src": "1421:82:11"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "setPublicKey",
"payable": false,
"scope": 1542,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "key",
"scope": 1526,
"stateVariable": false,
"storageLocation": "default",
"type": "string memory",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "string",
"type": "string storage pointer"
},
"id": 1515,
"name": "ElementaryTypeName",
"src": "1617:6:11"
}
],
"id": 1516,
"name": "VariableDeclaration",
"src": "1617:10:11"
}
],
"id": 1517,
"name": "ParameterList",
"src": "1616:12:11"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1520,
"name": "ParameterList",
"src": "1649:0:11"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1514,
"type": "modifier ()",
"value": "onlyRevealer"
},
"id": 1518,
"name": "Identifier",
"src": "1636:12:11"
}
],
"id": 1519,
"name": "ModifierInvocation",
"src": "1636:12:11"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "string storage ref"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1491,
"type": "string storage ref",
"value": "publicKey"
},
"id": 1521,
"name": "Identifier",
"src": "1659:9:11"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1516,
"type": "string memory",
"value": "key"
},
"id": 1522,
"name": "Identifier",
"src": "1671:3:11"
}
],
"id": 1523,
"name": "Assignment",
"src": "1659:15:11"
}
],
"id": 1524,
"name": "ExpressionStatement",
"src": "1659:15:11"
}
],
"id": 1525,
"name": "Block",
"src": "1649:32:11"
}
],
"id": 1526,
"name": "FunctionDefinition",
"src": "1595:86:11"
},
{
"attributes": {
"constant": false,
"implemented": true,
"isConstructor": false,
"name": "setPrivateKey",
"payable": false,
"scope": 1542,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "key",
"scope": 1541,
"stateVariable": false,
"storageLocation": "default",
"type": "string memory",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "string",
"type": "string storage pointer"
},
"id": 1527,
"name": "ElementaryTypeName",
"src": "1796:6:11"
}
],
"id": 1528,
"name": "VariableDeclaration",
"src": "1796:10:11"
}
],
"id": 1529,
"name": "ParameterList",
"src": "1795:12:11"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1532,
"name": "ParameterList",
"src": "1828:0:11"
},
{
"attributes": {
"arguments": [
null
]
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1514,
"type": "modifier ()",
"value": "onlyRevealer"
},
"id": 1530,
"name": "Identifier",
"src": "1815:12:11"
}
],
"id": 1531,
"name": "ModifierInvocation",
"src": "1815:12:11"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "string storage ref"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1493,
"type": "string storage ref",
"value": "privateKey"
},
"id": 1533,
"name": "Identifier",
"src": "1838:10:11"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1528,
"type": "string memory",
"value": "key"
},
"id": 1534,
"name": "Identifier",
"src": "1851:3:11"
}
],
"id": 1535,
"name": "Assignment",
"src": "1838:16:11"
}
],
"id": 1536,
"name": "ExpressionStatement",
"src": "1838:16:11"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"arguments": [
null
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
null
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1487,
"type": "function ()",
"value": "KeyReleased"
},
"id": 1537,
"name": "Identifier",
"src": "1864:11:11"
}