{
    "Function": "addMember",
    "File": "contracts/Community.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts-upgradeable/metatx/ERC2771ContextUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol",
        "node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol",
        "contracts/interfaces/ICommunity.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "checkSignatureValidity",
        "keccak256(bytes)",
        "abi.decode()",
        "checkSignatureValidity",
        "require(bool,string)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function addMember(bytes calldata _data, bytes calldata _signature)\n        external\n        virtual\n        override\n    {\n        // Compute hash from bytes\n        bytes32 _hash = keccak256(_data);\n\n        // Decode params from _data\n        (\n            uint256 _communityID,\n            address _newMemberAddr,\n            bytes memory _messageHash\n        ) = abi.decode(_data, (uint256, address, bytes));\n\n        CommunityStruct storage _community = _communities[_communityID];\n\n        // check signatures\n        checkSignatureValidity(_community.owner, _hash, _signature, 0); // must be community owner\n        checkSignatureValidity(_newMemberAddr, _hash, _signature, 1); // must be new member\n\n        // Revert if new member already exists\n        require(\n            !_community.isMember[_newMemberAddr],\n            \"Community::Member Exists\"\n        );\n\n        // Store updated community details\n        uint256 _memberCount = _community.memberCount;\n        _community.memberCount = _memberCount + 1;\n        _community.members[_memberCount] = _newMemberAddr;\n        _community.isMember[_newMemberAddr] = true;\n\n        emit MemberAdded(_communityID, _newMemberAddr, _messageHash);\n    }"
}