secretstore-contracts
Version:
Secret Store permissioning and service contracts collection and toolkit.
1,152 lines (1,151 loc) • 577 kB
JSON
{
"contractName": "SecretStoreServiceBase",
"abi": [
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"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": "isOwner",
"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"
},
{
"inputs": [
{
"name": "keyServerSetAddressInit",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "keyServersCount",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "keyServer",
"type": "address"
}
],
"name": "requireKeyServer",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "drain",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "//! The Secret Store service contract intefaces.\n//!\n//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd.\n//!\n//! Licensed under the Apache License, Version 2.0 (the \"License\");\n//! you may not use this file except in compliance with the License.\n//! You may obtain a copy of the License at\n//!\n//! http://www.apache.org/licenses/LICENSE-2.0\n//!\n//! Unless required by applicable law or agreed to in writing, software\n//! distributed under the License is distributed on an \"AS IS\" BASIS,\n//! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//! See the License for the specific language governing permissions and\n//! limitations under the License.\n\npragma solidity ^0.4.24;\n\nimport \"openzeppelin-solidity/contracts/ownership/Ownable.sol\";\nimport \"../interfaces/KeyServerSet.sol\";\n\n\n/// Base contract for all Secret Store services.\ncontract SecretStoreServiceBase is Ownable {\n /// Response support.\n enum ResponseSupport { Confirmed, Unconfirmed, Impossible }\n\n /// Single service request responses.\n struct RequestResponses {\n /// Number of block when servers set has been changed last time.\n /// This whole structure is valid when this value stays the same.\n /// Once this changes, all previous responses are erased.\n uint256 keyServerSetChangeBlock;\n /// We only support up to 256 key servers. If bit is set, this means that key server\n /// has already voted for some confirmation (we do not care about exact response).\n uint256 respondedKeyServersMask;\n /// Number of key servers that have responded to request (number of ones in respondedKeyServersMask).\n uint8 respondedKeyServersCount;\n /// Response => number of supporting key servers.\n mapping (bytes32 => uint8) responsesSupport;\n /// Maximal support of single response.\n uint8 maxResponseSupport;\n /// All responses that are in responsesSupport. In ideal world, when all\n /// key servers are working correctly, there'll be 1 response. Max 256 responses.\n bytes32[] responses;\n }\n\n /// Only pass when fee is paid.\n modifier whenFeePaid(uint256 amount) {\n require(msg.value >= amount, \"Transaction value is not enough.\");\n _;\n }\n\n /// Only pass when 'valid' public is passed.\n modifier validPublic(bytes publicKey) {\n require(publicKey.length == 64, \"Public key is not valid.\");\n _;\n }\n\n /// Constructor.\n constructor(address keyServerSetAddressInit) internal {\n keyServerSetAddress = keyServerSetAddressInit;\n }\n\n /// Return number of key servers.\n function keyServersCount() public view returns (uint8) {\n return KeyServerSet(keyServerSetAddress).getCurrentKeyServersCount();\n }\n\n /// Return index of key server at given address.\n function requireKeyServer(address keyServer) public view returns (uint8) {\n return KeyServerSet(keyServerSetAddress).getCurrentKeyServerIndex(keyServer);\n }\n\n /// Drain balance of sender key server.\n function drain() public {\n uint256 balance = balances[msg.sender];\n require(balance != 0, \"Balance is 0.\");\n balances[msg.sender] = 0;\n msg.sender.transfer(balance);\n }\n\n /// Deposit equal share of amount to each of key servers.\n function deposit() internal {\n uint8 count = keyServersCount();\n uint256 amount = msg.value;\n uint256 share = amount / count;\n for (uint8 i = 0; i < count - 1; i++) {\n address keyServer = KeyServerSet(keyServerSetAddress).getCurrentKeyServer(i);\n balances[keyServer] += share;\n amount = amount - share;\n }\n\n address lastKeyServer = KeyServerSet(keyServerSetAddress).getCurrentKeyServer(count - 1);\n balances[lastKeyServer] += amount;\n }\n\n /// Returns true if response from given keyServer is required.\n function isResponseRequired(RequestResponses storage responses, uint8 keyServerIndex) internal view returns (bool) {\n // if servers set has changed, new response is definitely required\n uint256 keyServerSetChangeBlock = KeyServerSet(keyServerSetAddress).getCurrentLastChange();\n if (keyServerSetChangeBlock != responses.keyServerSetChangeBlock) {\n return true;\n }\n\n // only require response when server has not responded before\n uint256 keyServerMask = (uint256(1) << keyServerIndex);\n return ((responses.respondedKeyServersMask & keyServerMask) == 0);\n }\n\n /// Insert key server confirmation.\n function insertResponse(\n RequestResponses storage responses,\n uint8 keyServerIndex,\n uint8 threshold,\n bytes32 response) internal returns (ResponseSupport)\n {\n // check that servers set is still the same (and all previous responses are valid)\n uint256 keyServerSetChangeBlock = KeyServerSet(keyServerSetAddress).getCurrentLastChange();\n if (responses.respondedKeyServersCount == 0) {\n responses.keyServerSetChangeBlock = keyServerSetChangeBlock;\n } else if (responses.keyServerSetChangeBlock != keyServerSetChangeBlock) {\n resetResponses(responses, keyServerSetChangeBlock);\n }\n\n // check if key server has already responded\n uint256 keyServerMask = (uint256(1) << keyServerIndex);\n if ((responses.respondedKeyServersMask & keyServerMask) != 0) {\n return ResponseSupport.Unconfirmed;\n }\n\n // insert response\n uint8 responseSupport = responses.responsesSupport[response] + 1;\n responses.respondedKeyServersMask |= keyServerMask;\n responses.respondedKeyServersCount += 1;\n responses.responsesSupport[response] = responseSupport;\n if (responseSupport == 1) {\n responses.responses.push(response);\n }\n if (responseSupport >= responses.maxResponseSupport) {\n responses.maxResponseSupport = responseSupport;\n\n // check if passed response has received enough support\n if (threshold <= responseSupport - 1) {\n return ResponseSupport.Confirmed;\n }\n }\n\n // check if max confirmation CAN receive enough support\n uint8 keyServersLeft = keyServersCount() - responses.respondedKeyServersCount;\n if (threshold > responses.maxResponseSupport + keyServersLeft - 1) {\n return ResponseSupport.Impossible;\n }\n\n return ResponseSupport.Unconfirmed;\n }\n\n /// Clear responses before removal.\n function clearResponses(RequestResponses storage responses) internal {\n for (uint256 i = 0; i < responses.responses.length; ++i) {\n delete responses.responsesSupport[responses.responses[i]];\n }\n }\n\n /// Remove request id from array.\n function removeRequestKey(bytes32[] storage requests, bytes32 request) internal {\n for (uint i = 0; i < requests.length; ++i) {\n if (requests[i] == request) {\n requests[i] = requests[requests.length - 1];\n requests.length = requests.length - 1;\n break;\n }\n }\n }\n\n /// Reset responses.\n function resetResponses(RequestResponses storage responses, uint256 keyServerSetChangeBlock) private {\n clearResponses(responses);\n responses.keyServerSetChangeBlock = keyServerSetChangeBlock;\n responses.respondedKeyServersMask = 0;\n responses.respondedKeyServersCount = 0;\n responses.maxResponseSupport = 0;\n responses.responses.length = 0;\n }\n\n /// Address of KeyServerSet contract.\n address private keyServerSetAddress;\n /// Balances of key servers.\n mapping (address => uint256) private balances;\n /// Active requests.\n mapping (bytes32 => RequestResponses) private requests;\n}\n",
"sourcePath": "/home/aznagy/work/secretstore/secretstore-contracts/contracts/service/SecretStoreServiceBase.sol",
"ast": {
"absolutePath": "/home/aznagy/work/secretstore/secretstore-contracts/contracts/service/SecretStoreServiceBase.sol",
"exportedSymbols": {
"SecretStoreServiceBase": [
3512
]
},
"id": 3513,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 2986,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "689:24:8"
},
{
"absolutePath": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"file": "openzeppelin-solidity/contracts/ownership/Ownable.sol",
"id": 2987,
"nodeType": "ImportDirective",
"scope": 3513,
"sourceUnit": 4824,
"src": "715:63:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/aznagy/work/secretstore/secretstore-contracts/contracts/interfaces/KeyServerSet.sol",
"file": "../interfaces/KeyServerSet.sol",
"id": 2988,
"nodeType": "ImportDirective",
"scope": 3513,
"sourceUnit": 577,
"src": "779:40:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 2989,
"name": "Ownable",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 4823,
"src": "906:7:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Ownable_$4823",
"typeString": "contract Ownable"
}
},
"id": 2990,
"nodeType": "InheritanceSpecifier",
"src": "906:7:8"
}
],
"contractDependencies": [
4823
],
"contractKind": "contract",
"documentation": "Base contract for all Secret Store services.",
"fullyImplemented": true,
"id": 3512,
"linearizedBaseContracts": [
3512,
4823
],
"name": "SecretStoreServiceBase",
"nodeType": "ContractDefinition",
"nodes": [
{
"canonicalName": "SecretStoreServiceBase.ResponseSupport",
"id": 2994,
"members": [
{
"id": 2991,
"name": "Confirmed",
"nodeType": "EnumValue",
"src": "969:9:8"
},
{
"id": 2992,
"name": "Unconfirmed",
"nodeType": "EnumValue",
"src": "980:11:8"
},
{
"id": 2993,
"name": "Impossible",
"nodeType": "EnumValue",
"src": "993:10:8"
}
],
"name": "ResponseSupport",
"nodeType": "EnumDefinition",
"src": "946:59:8"
},
{
"canonicalName": "SecretStoreServiceBase.RequestResponses",
"id": 3010,
"members": [
{
"constant": false,
"id": 2996,
"name": "keyServerSetChangeBlock",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "1300:31:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2995,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1300:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 2998,
"name": "respondedKeyServersMask",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "1525:31:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2997,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1525:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3000,
"name": "respondedKeyServersCount",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "1676:30:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 2999,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "1676:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3004,
"name": "responsesSupport",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "1774:43:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint8_$",
"typeString": "mapping(bytes32 => uint8)"
},
"typeName": {
"id": 3003,
"keyType": {
"id": 3001,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1783:7:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Mapping",
"src": "1774:26:8",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint8_$",
"typeString": "mapping(bytes32 => uint8)"
},
"valueType": {
"id": 3002,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "1794:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3006,
"name": "maxResponseSupport",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "1875:24:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 3005,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "1875:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 3009,
"name": "responses",
"nodeType": "VariableDeclaration",
"scope": 3010,
"src": "2080:19:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 3007,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "2080:7:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 3008,
"length": null,
"nodeType": "ArrayTypeName",
"src": "2080:9:8",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "RequestResponses",
"nodeType": "StructDefinition",
"scope": 3512,
"src": "1053:1053:8",
"visibility": "public"
},
{
"body": {
"id": 3023,
"nodeType": "Block",
"src": "2185:92:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3018,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 3015,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4838,
"src": "2203:3:8",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 3016,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "value",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2203:9:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 3017,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3012,
"src": "2216:6:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "2203:19:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5472616e73616374696f6e2076616c7565206973206e6f7420656e6f7567682e",
"id": 3019,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2224:34:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_2e4febf048d0fe99c3c2c50b647281bff807d672b3037bb311fe7ebee57e1add",
"typeString": "literal_string \"Transaction value is not enough.\""
},
"value": "Transaction value is not enough."
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_2e4febf048d0fe99c3c2c50b647281bff807d672b3037bb311fe7ebee57e1add",
"typeString": "literal_string \"Transaction value is not enough.\""
}
],
"id": 3014,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4841,
4842
],
"referencedDeclaration": 4842,
"src": "2195:7:8",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 3020,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2195:64:8",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3021,
"nodeType": "ExpressionStatement",
"src": "2195:64:8"
},
{
"id": 3022,
"nodeType": "PlaceholderStatement",
"src": "2269:1:8"
}
]
},
"documentation": "Only pass when fee is paid.",
"id": 3024,
"name": "whenFeePaid",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 3013,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3012,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 3024,
"src": "2169:14:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3011,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2169:7:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2168:16:8"
},
"src": "2148:129:8",
"visibility": "internal"
},
{
"body": {
"id": 3037,
"nodeType": "Block",
"src": "2370:87:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3032,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 3029,
"name": "publicKey",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3026,
"src": "2388:9:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 3030,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "2388:16:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3634",
"id": 3031,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2408:2:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_64_by_1",
"typeString": "int_const 64"
},
"value": "64"
},
"src": "2388:22:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5075626c6963206b6579206973206e6f742076616c69642e",
"id": 3033,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2412:26:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_7da3fda962f2872ab8782297844eb72485ecb2e74537ffcfb05b9e5c3c717e43",
"typeString": "literal_string \"Public key is not valid.\""
},
"value": "Public key is not valid."
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_7da3fda962f2872ab8782297844eb72485ecb2e74537ffcfb05b9e5c3c717e43",
"typeString": "literal_string \"Public key is not valid.\""
}
],
"id": 3028,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4841,
4842
],
"referencedDeclaration": 4842,
"src": "2380:7:8",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 3034,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2380:59:8",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3035,
"nodeType": "ExpressionStatement",
"src": "2380:59:8"
},
{
"id": 3036,
"nodeType": "PlaceholderStatement",
"src": "2449:1:8"
}
]
},
"documentation": "Only pass when 'valid' public is passed.",
"id": 3038,
"name": "validPublic",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 3027,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3026,
"name": "publicKey",
"nodeType": "VariableDeclaration",
"scope": 3038,
"src": "2353:15:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 3025,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2353:5:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2352:17:8"
},
"src": "2332:125:8",
"visibility": "internal"
},
{
"body": {
"id": 3047,
"nodeType": "Block",
"src": "2538:62:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3045,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3043,
"name": "keyServerSetAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3503,
"src": "2548:19:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 3044,
"name": "keyServerSetAddressInit",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3040,
"src": "2570:23:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "2548:45:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 3046,
"nodeType": "ExpressionStatement",
"src": "2548:45:8"
}
]
},
"documentation": "Constructor.",
"id": 3048,
"implemented": true,
"isConstructor": true,
"isDeclaredConst": false,
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3041,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3040,
"name": "keyServerSetAddressInit",
"nodeType": "VariableDeclaration",
"scope": 3048,
"src": "2496:31:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 3039,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2496:7:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2495:33:8"
},
"payable": false,
"returnParameters": {
"id": 3042,
"nodeType": "ParameterList",
"parameters": [],
"src": "2538:0:8"
},
"scope": 3512,
"src": "2484:116:8",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 3059,
"nodeType": "Block",
"src": "2699:85:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3054,
"name": "keyServerSetAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3503,
"src": "2729:19:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 3053,
"name": "KeyServerSet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 452,
"src": "2716:12:8",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_KeyServerSet_$452_$",
"typeString": "type(contract KeyServerSet)"
}
},
"id": 3055,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2716:33:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_KeyServerSet_$452",
"typeString": "contract KeyServerSet"
}
},
"id": 3056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getCurrentKeyServersCount",
"nodeType": "MemberAccess",
"referencedDeclaration": 424,
"src": "2716:59:8",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$",
"typeString": "function () view external returns (uint8)"
}
},
"id": 3057,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2716:61:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"functionReturnParameters": 3052,
"id": 3058,
"nodeType": "Return",
"src": "2709:68:8"
}
]
},
"documentation": "Return number of key servers.",
"id": 3060,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "keyServersCount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3049,
"nodeType": "ParameterList",
"parameters": [],
"src": "2668:2:8"
},
"payable": false,
"returnParameters": {
"id": 3052,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3051,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 3060,
"src": "2692:5:8",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 3050,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "2692:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2691:7:8"
},
"scope": 3512,
"src": "2644:140:8",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 3074,
"nodeType": "Block",
"src": "2916:93:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3071,
"name": "keyServer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3062,
"src": "2992:9:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 3068,
"name": "keyServerSetAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3503,
"src": "2946:19:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 3067,
"name": "KeyServerSet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 452,
"src": "2933:12:8",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_KeyServerSet_$452_$",
"typeString": "type(contract KeyServerSet)"
}
},
"id": 3069,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2933:33:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_KeyServerSet_$452",
"typeString": "contract KeyServerSet"
}
},
"id": 3070,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getCurrentKeyServerIndex",
"nodeType": "MemberAccess",
"referencedDeclaration": 419,
"src": "2933:58:8",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint8_$",
"typeString": "function (address) view external returns (uint8)"
}
},
"id": 3072,
"isConstant": false,