# Groups

### Table of Contents

1. [Events](#events)
2. [Public Functions](#public-functions)

***

## <mark style="color:purple;">Events</mark>

### logLeaveGroup

This event is emitted when a member leaves a group.

### logJoinGroup

This event is emitted when a new member joins a group.

### logUpdateGroupNameFormat

This event is emitted when the group name's format is updated.

***

## <mark style="color:purple;">Public Functions</mark>

### getOwnerOfGroupByID

Retrieves the owner address of the specified group.

**Inputs**

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| groupID | uint256 | Unique ID of the group |

**Returns**

| Name | Type    | Description                   |
| ---- | ------- | ----------------------------- |
|      | address | Address of the owner of group |

```javascript
// Example usage with ethers.js
const groupID = 1234; // Replace with your groupID
const owner = await contract.getOwnerOfGroupByID(groupID);
```

***

### getMembersOfGroupByID

Retrieves the member addresses of the specified group.

**Inputs**

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| groupID | uint256 | Unique ID of the group |

**Returns**

| Name | Type       | Description                           |
| ---- | ---------- | ------------------------------------- |
|      | address\[] | Addresses of the members of the group |

```javascript
// Example usage with ethers.js
const groupID = 1234; // Replace with your groupID
const members = await contract.getMembersOfGroupByID(groupID);
```

***

### isMemberOfGroupByID

Checks if a user or group is a member of the specified group.

**Inputs**

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| groupID | uint256 | Unique ID of the group |
| member  | address | Address of the member  |

**Returns**

| Name | Type | Description                                |
| ---- | ---- | ------------------------------------------ |
|      | bool | True if they are a member, false otherwise |

```javascript
// Example usage with ethers.js
const groupID = 1234; // Replace with your groupID
const memberAddress = '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520'; // Replace with your member address
const isMember = await contract.isMemberOfGroupByID(groupID, memberAddress);
```

***

### getGroupID

Gets the Group ID of a group from the group name.

**Inputs**

| Name      | Type   | Description       |
| --------- | ------ | ----------------- |
| groupName | string | Name of the group |

**Returns**

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
|      | uint256 | Unique ID of the group |

```javascript
// Example usage with ethers.js
const groupName = 'GroupName'; // Replace with your group name
const groupID = await contract.getGroupID(groupName);
```

***

### getGroupAddressFromID

Gets the Group address of a group from the group ID.

**Inputs**

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| groupID | uint256 | Unique ID of the group |

**Returns**

| Name | Type    | Description          |
| ---- | ------- | -------------------- |
|      | address | Address of the group |

```javascript
// Example usage with ethers.js
const groupID = 1234; // Replace with your groupID
const groupAddress = await contract.getGroupAddressFromID(groupID);
```

***

### getGroupIDFromAddress

Gets the Group ID of a group from the group address.

**Inputs**

| Name         | Type    | Description          |
| ------------ | ------- | -------------------- |
| groupAddress | address | Address of the group |

**Returns**

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
|      | uint256 | Unique ID of the group |

```javascript
// Example usage with ethers.js
const groupAddress = '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520'; // Replace with your group address
const groupID = await contract.getGroupIDFromAddress(groupAddress);
```

***

### getOwnerOfGroupByAddress

Gets the owner address of a group from the group address.

**Inputs**

| Name         | Type    | Description          |
| ------------ | ------- | -------------------- |
| groupAddress | address | Address of the group |

**Returns**

| Name | Type    | Description                |
| ---- | ------- | -------------------------- |
|      | address | Address of the group owner |

```javascript
// Example usage with ethers.js
const groupAddress = '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520'; // Replace with your group address
const ownerAddress = await contract
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kuthulu.xyz/contracts/groups.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
