# GroupTokens

This documentation provides the information needed to interact with the GroupTokens Smart Contract deployed on the Polygon Network. This smart contract is an upgradeable ERC721 token contract, designed to allow the minting and managing of unique group tokens, or Spaces.

### Table of Contents

1. [Public Functions](#public-functions)
2. [Multi-Sig Functions](#multi-sig-functions)

***

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

### getGroupID

Gets a group ID from a group name.

**Input**

| Name      |  Type  | Description           |
| --------- | :----: | --------------------- |
| groupName | string | The name of the group |

**Returns**

| Name    |   Type  | Description                |
| ------- | :-----: | -------------------------- |
| uint256 | integer | The unique ID of the group |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const groupName = 'MyAwesomeGroup';

const groupID = await contract.getGroupID(groupName);
console.log(`The ID of the group ${groupName} is ${groupID}`);
```

***

### isGroupAvailable

Checks if a group is available to mint.

**Input**

| Name      |  Type  | Description           |
| --------- | :----: | --------------------- |
| groupName | string | The name of the group |

**Returns**

| Name |   Type  | Description                                                          |
| ---- | :-----: | -------------------------------------------------------------------- |
| bool | boolean | True if the group is available to mint, false if it's already minted |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const groupName = 'MyAwesomeGroup';

const available = await contract.isGroupAvailable(groupName);
console.log(`Is the group ${groupName} available? ${available}`);
```

***

### mintGroup

Mints a group / Space.

**Input**

| Name      |  Type  | Description           |
| --------- | :----: | --------------------- |
| groupName | string | The name of the group |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const groupName = 'MyAwesomeGroup';

await contract.mintGroup(groupName, {
  value: ethers.utils.parseEther("1.0"), // 1 ETH
});
```

***

### tokenURI

Gets the token metadata.

**Input**

| Name      |   Type  | Description         |
| --------- | :-----: | ------------------- |
| \_tokenID | uint256 | The unique Group ID |

**Returns**

| Name   |  Type  | Description                      |
| ------ | :----: | -------------------------------- |
| string | string | The unique metadata of the group |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;

const metadata = await contract.tokenURI(tokenId);
console.log(`The metadata of the token ${tokenId} is ${metadata}`);
```

***

## <mark style="color:purple;">Multi-Sig Functions</mark>

### addMultiSigLock

Adds MultiSig Address Locking for Transfers. After adding, the address used for multi-sig must call activateMultiSigLock() to activate it.

**Input**

| Name            |   Type  | Description                                          |
| --------------- | :-----: | ---------------------------------------------------- |
| tokenID         | uint256 | The token ID to lock with the multi-sig address      |
| multiSigAddress | address | The wallet address to be used to lock the token with |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;
const multiSigAddress = '0xYourMultiSigWalletAddress';

await contract.addMultiSigLock(tokenId, multiSigAddress);
```

***

### activateMultiSigLock

Activates Multi Sig lock from address added to token. This is done to ensure Multi Sig Address is correct before locking.

**Input**

| Name    |   Type  | Description                                     |
| ------- | :-----: | ----------------------------------------------- |
| tokenID | uint256 | The token ID to lock with the multi-sig address |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;

await contract.activateMultiSigLock(tokenId);
```

***

### removeMultiSigLock

Removes MultiSig Lock From Token Transfer. Must be called by the address that was setup to lock the token.

**Input**

| Name    |   Type  | Description                                       |
| ------- | :-----: | ------------------------------------------------- |
| tokenID | uint256 | The token ID to unlock with the multi-sig address |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;

await contract.removeMultiSigLock(tokenId);
```

***

### getMultiSigAddress

Checks if token is locked. Returns 0x0 if not locked.

**Input**

| Name    |   Type  | Description                                      |
| ------- | :-----: | ------------------------------------------------ |
| tokenID | uint256 | The token ID to return the multi-sig address for |

**Returns**

| Name    |   Type  | Description                                             |
| ------- | :-----: | ------------------------------------------------------- |
| address | address | The wallet address used to lock the token from transfer |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;

const multiSigAddress = await contract.getMultiSigAddress(tokenId);
console.log(`The multi-sig address of the token ${tokenId} is ${multiSigAddress}`);
```

***

### isMultiSigLocked

Checks if token is locked.

**Input**

| Name    |   Type  | Description                                      |
| ------- | :-----: | ------------------------------------------------ |
| tokenID | uint256 | The token ID to return the multi-sig address for |

**Returns**

| Name     |     Type    | Description                                                           |
| -------- | :---------: | --------------------------------------------------------------------- |
| bool\[2] | boolean\[2] | 0 = True / False if locked, 1 = True / False if Locking Address Added |

**Example with ethers.js**

```javascript
const ethers = require('ethers');

const tokenId = 1234;

const [isLocked, isAddrAdded] = await contract.isMultiSigLocked(tokenId);
console.log(`Is the token ${tokenId} locked? ${isLocked}, Is Address Added? ${isAddrAdded}`);
```


---

# 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/grouptokens.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.
