UNPKG

@daostack/access_control

Version:

Capability-based access control for Ethereum smart contracts.

1,256 lines (1,255 loc) 208 kB
{ "contractName": "Group", "abi": [ { "constant": true, "inputs": [ { "name": "_account", "type": "address" } ], "name": "isMember", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_contract", "type": "address" }, { "name": "_data", "type": "bytes" } ], "name": "forward", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" } ], "bytecode": "0x", "deployedBytecode": "0x", "sourceMap": "", "deployedSourceMap": "", "source": "pragma solidity ^0.4.24;\n\n\n/**\n * @title Abstract base contract for all groups.\n */\ncontract Group {\n\n /**\n * @dev Check if an account belongs to this group.\n * @param _account the account to check.\n */\n function isMember(address _account) public view returns(bool);\n\n /**\n * @dev Modifier for restricting access to members of the group.\n */\n modifier onlyMember() {\n require(isMember(msg.sender), \"Not a member of this group\");\n _;\n }\n\n /**\n * @dev Call a method on a contract in the name of the group.\n * @param _contract contract address to call.\n * @param _data ABI encoded function call data.\n */\n function forward(address _contract, bytes _data) public payable onlyMember {\n // solium-disable-next-line security/no-low-level-calls\n bool result = _contract.call(_data);\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize)\n\n switch result\n // call returns 0 on error.\n case 0 { revert(0, returndatasize) }\n default { return(0, returndatasize) }\n }\n }\n}\n\n\n/**\n * @title Group with fixed members set at creation time.\n */\ncontract FixedGroup is Group {\n mapping(address => bool) members;\n\n /**\n * @notice Can use up to 935 members (tested with 8M block gas limit)\n */\n constructor(address[] _members) public {\n for (uint i = 0; i < _members.length; i++) {\n members[_members[i]] = true;\n }\n }\n\n function isMember(address _account) public view returns(bool) {\n return members[_account];\n }\n}\n\n\n/**\n * @title Group that comprises of all members belonging to at least one subgroup.\n */\ncontract UnionGroup is Group {\n Group[] subgroups;\n\n /**\n * @notice Can use up to 294 sub-groups (tested with 8M block gas limit)\n */\n constructor(Group[] _subgroups) public {\n subgroups = _subgroups;\n }\n\n function isMember(address _account) public view returns(bool) {\n for (uint i = 0; i < subgroups.length; i++) {\n if (subgroups[i].isMember(_account)) {\n return true;\n }\n }\n return false;\n }\n}\n\n\n/**\n * @title Group that comprises of all members belonging to all subgroups.\n */\ncontract IntersectionGroup is Group {\n Group[] subgroups;\n\n /**\n * @notice Can use up to 294 sub-groups (tested with 8M block gas limit)\n */\n constructor(Group[] _subgroups) public {\n subgroups = _subgroups;\n }\n\n function isMember(address _account) public view returns(bool) {\n for (uint i = 0; i < subgroups.length; i++) {\n if (!subgroups[i].isMember(_account)) {\n return false;\n }\n }\n return true;\n }\n}\n\n\n/**\n * @title Group that comprises of all members not belonging to a group.\n */\ncontract InverseGroup is Group {\n Group group;\n\n constructor(Group _group) public {\n group = _group;\n }\n\n function isMember(address _account) public view returns(bool) {\n return !group.isMember(_account);\n }\n}\n", "sourcePath": "/home/tsuberim/projects/daostack/access_control/contracts/Groups.sol", "ast": { "absolutePath": "/home/tsuberim/projects/daostack/access_control/contracts/Groups.sol", "exportedSymbols": { "FixedGroup": [ 225 ], "Group": [ 178 ], "IntersectionGroup": [ 326 ], "InverseGroup": [ 355 ], "UnionGroup": [ 275 ] }, "id": 356, "nodeType": "SourceUnit", "nodes": [ { "id": 140, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:3" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": "@title Abstract base contract for all groups.", "fullyImplemented": false, "id": 178, "linearizedBaseContracts": [ 178 ], "name": "Group", "nodeType": "ContractDefinition", "nodes": [ { "body": null, "documentation": "@dev Check if an account belongs to this group.\n@param _account the account to check.", "id": 147, "implemented": false, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "isMember", "nodeType": "FunctionDefinition", "parameters": { "id": 143, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 142, "name": "_account", "nodeType": "VariableDeclaration", "scope": 147, "src": "240:16:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 141, "name": "address", "nodeType": "ElementaryTypeName", "src": "240:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "239:18:3" }, "payable": false, "returnParameters": { "id": 146, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 145, "name": "", "nodeType": "VariableDeclaration", "scope": 147, "src": "278:4:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 144, "name": "bool", "nodeType": "ElementaryTypeName", "src": "278:4:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "277:6:3" }, "scope": 178, "src": "222:62:3", "stateMutability": "view", "superFunction": null, "visibility": "public" }, { "body": { "id": 158, "nodeType": "Block", "src": "397:87:3", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 151, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1462, "src": "424:3:3", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 152, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "424:10:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 150, "name": "isMember", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 147, "src": "415:8:3", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$", "typeString": "function (address) view returns (bool)" } }, "id": 153, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "415:20:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "4e6f742061206d656d626572206f6620746869732067726f7570", "id": 154, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "437:28:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_8357529da5166d0ff49b0d6f6c194fd933e0040a1faac958f58e10137eee2940", "typeString": "literal_string \"Not a member of this group\"" }, "value": "Not a member of this group" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_8357529da5166d0ff49b0d6f6c194fd933e0040a1faac958f58e10137eee2940", "typeString": "literal_string \"Not a member of this group\"" } ], "id": 149, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 1465, 1466 ], "referencedDeclaration": 1466, "src": "407:7:3", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 155, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "407:59:3", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 156, "nodeType": "ExpressionStatement", "src": "407:59:3" }, { "id": 157, "nodeType": "PlaceholderStatement", "src": "476:1:3" } ] }, "documentation": "@dev Modifier for restricting access to members of the group.", "id": 159, "name": "onlyMember", "nodeType": "ModifierDefinition", "parameters": { "id": 148, "nodeType": "ParameterList", "parameters": [], "src": "394:2:3" }, "src": "375:109:3", "visibility": "internal" }, { "body": { "id": 176, "nodeType": "Block", "src": "749:463:3", "statements": [ { "assignments": [ 169 ], "declarations": [ { "constant": false, "id": 169, "name": "result", "nodeType": "VariableDeclaration", "scope": 177, "src": "823:11:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 168, "name": "bool", "nodeType": "ElementaryTypeName", "src": "823:4:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "id": 174, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 172, "name": "_data", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 163, "src": "852:5:3", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "expression": { "argumentTypes": null, "id": 170, "name": "_contract", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 161, "src": "837:9:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 171, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "call", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "837:14:3", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$__$returns$_t_bool_$", "typeString": "function () payable returns (bool)" } }, "id": 173, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "837:21:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "VariableDeclarationStatement", "src": "823:35:3" }, { "externalReferences": [ { "result": { "declaration": 169, "isOffset": false, "isSlot": false, "src": "1051:6:3", "valueSize": 1 } } ], "id": 175, "nodeType": "InlineAssembly", "operations": "{\n returndatacopy(0, 0, returndatasize())\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n}", "src": "932:280:3" } ] }, "documentation": "@dev Call a method on a contract in the name of the group.\n@param _contract contract address to call.\n@param _data ABI encoded function call data.", "id": 177, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [ { "arguments": null, "id": 166, "modifierName": { "argumentTypes": null, "id": 165, "name": "onlyMember", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 159, "src": "738:10:3", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "738:10:3" } ], "name": "forward", "nodeType": "FunctionDefinition", "parameters": { "id": 164, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 161, "name": "_contract", "nodeType": "VariableDeclaration", "scope": 177, "src": "691:17:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 160, "name": "address", "nodeType": "ElementaryTypeName", "src": "691:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 163, "name": "_data", "nodeType": "VariableDeclaration", "scope": 177, "src": "710:11:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 162, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "710:5:3", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "690:32:3" }, "payable": true, "returnParameters": { "id": 167, "nodeType": "ParameterList", "parameters": [], "src": "749:0:3" }, "scope": 178, "src": "674:538:3", "stateMutability": "payable", "superFunction": null, "visibility": "public" } ], "scope": 356, "src": "84:1130:3" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 179, "name": "Group", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 178, "src": "1305:5:3", "typeDescriptions": { "typeIdentifier": "t_contract$_Group_$178", "typeString": "contract Group" } }, "id": 180, "nodeType": "InheritanceSpecifier", "src": "1305:5:3" } ], "contractDependencies": [ 178 ], "contractKind": "contract", "documentation": "@title Group with fixed members set at creation time.", "fullyImplemented": true, "id": 225, "linearizedBaseContracts": [ 225, 178 ], "name": "FixedGroup", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 184, "name": "members", "nodeType": "VariableDeclaration", "scope": 225, "src": "1317:32:3", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "typeName": { "id": 183, "keyType": { "id": 181, "name": "address", "nodeType": "ElementaryTypeName", "src": "1325:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "1317:24:3", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "valueType": { "id": 182, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1336:4:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } }, "value": null, "visibility": "internal" }, { "body": { "id": 211, "nodeType": "Block", "src": "1485:111:3", "statements": [ { "body": { "id": 209, "nodeType": "Block", "src": "1538:52:3", "statements": [ { "expression": { "argumentTypes": null, "id": 207, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 201, "name": "members", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 184, "src": "1552:7:3", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" } }, "id": 205, "indexExpression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 202, "name": "_members", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 187, "src": "1560:8:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[] memory" } }, "id": 204, "indexExpression": { "argumentTypes": null, "id": 203, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 191, "src": "1569:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1560:11:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", "src": "1552:20:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "74727565", "id": 206, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "1575:4:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "src": "1552:27:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 208, "nodeType": "ExpressionStatement", "src": "1552:27:3" } ] }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 197, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 194, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 191, "src": "1512:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 195, "name": "_members", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 187, "src": "1516:8:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[] memory" } }, "id": 196, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1516:15:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1512:19:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 210, "initializationExpression": { "assignments": [ 191 ], "declarations": [ { "constant": false, "id": 191, "name": "i", "nodeType": "VariableDeclaration", "scope": 212, "src": "1500:6:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 190, "name": "uint", "nodeType": "ElementaryTypeName", "src": "1500:4:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 193, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 192, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1509:1:3", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "1500:10:3" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 199, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "1533:3:3", "subExpression": { "argumentTypes": null, "id": 198, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 191, "src": "1533:1:3", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 200, "nodeType": "ExpressionStatement", "src": "1533:3:3" }, "nodeType": "ForStatement", "src": "1495:95:3" } ] }, "documentation": "@notice Can use up to 935 members (tested with 8M block gas limit)", "id": 212, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 188, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 187, "name": "_members", "nodeType": "VariableDeclaration", "scope": 212, "src": "1458:18:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[]" }, "typeName": { "baseType": { "id": 185, "name": "address", "nodeType": "ElementaryTypeName", "src": "1458:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 186, "length": null, "nodeType": "ArrayTypeName", "src": "1458:9:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[]" } }, "value": null, "visibility": "internal" } ], "src": "1457:20:3" }, "payable": false, "returnParameters": { "id": 189, "nodeType": "ParameterList", "parameters": [], "src": "1485:0:3" }, "scope": 225, "src": "1446:150:3", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 223, "nodeType": "Block", "src": "1664:41:3", "statements": [ { "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 219, "name": "members", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 184, "src": "1681:7:3", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" } }, "id": 221, "indexExpression": { "argumentTypes": null, "id": 220, "name": "_account", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 214, "src": "1689:8:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1681:17:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 218, "id": 222, "nodeType": "Return", "src": "1674:24:3" } ] }, "documentation": null, "id": 224, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "isMember", "nodeType": "FunctionDefinition", "parameters": { "id": 215, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 214, "name": "_account", "nodeType": "VariableDeclaration", "scope": 224, "src": "1620:16:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 213, "name": "address", "nodeType": "ElementaryTypeName", "src": "1620:7:3", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1619:18:3" }, "payable": false, "returnParameters": { "id": 218, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 217, "name": "", "nodeType": "VariableDeclaration", "scope": 224, "src": "1658:4:3", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 216, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1658:4:3", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1657:6:3" }, "scope": 225, "src": "1602:103:3", "stateMutability": "view", "superFunction": 147, "visibility": "public" } ], "scope": 356, "src": "1282:425:3" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 226, "name": "Group", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 178, "src": "1823:5:3", "typeDescriptions": { "typeIdentifier": "t_contract$_Group_$178", "typeString": "contract Group" } }, "id": 227, "nodeType": "InheritanceSpecifier", "src": "1823:5:3" } ], "contractDependencies": [ 178 ], "contractKind": "contract", "documentation": "@title Group that comprises of all members belonging to at least one subgroup.", "fullyImplemented": true, "id": 275, "linearizedBaseContracts": [ 275, 178 ], "name": "UnionGroup", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 230, "name": "subgroups", "nodeType": "VariableDeclaration", "scope": 275, "src": "1835:17:3", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Group_$178_$dyn_storage", "typeString": "contract Group[]" }, "typeName": { "baseType": { "contractScope": null, "id": 228, "name": "Group", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 178, "src": "1835:5:3", "typeDescriptions": { "typeIdentifier": "t_contract$_Group_$178", "typeString": "contract Group" } }, "id": 229, "length": null, "nodeType": "ArrayTypeName", "src": "1835:7:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Group_$178_$dyn_storage_ptr", "typeString": "contract Group[]" } }, "value": null, "visibility": "internal" }, { "body": { "id": 240, "nodeType": "Block", "src": "1991:39:3", "statements": [ { "expression": { "argumentTypes": null, "id": 238, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 236, "name": "subgroups", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 230, "src": "2001:9:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Group_$178_$dyn_storage", "typeString": "contract Group[] storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 237, "name": "_subgroups", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 233, "src": "2013:10:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Group_$178_$dyn_memory_ptr", "typeString": "contract Group[] memory" } }, "src": "2001:22:3", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Group_$178_$dyn_storage", "typeString": "contract Group[] storage ref" } }, "id": 239, "nodeType": "ExpressionStatement", "src": "2001:22:3" } ] }, "documentation": "@notice Can use up to 294 sub-groups (tested with 8M block gas limit)", "id": 241, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition",