> For the complete documentation index, see [llms.txt](https://docs.kuthulu.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kuthulu.xyz/contracts/tips.md).

# Tips

Tip Users and Groups / Spaces with MATIC or any ERC-20 token on Polygon

### Table of Contents

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

***

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

### logAddTip

This event is emitted when a tip is added to a post.

### logClaimTips

This event is emitted when tips are claimed by a user or group.

### logTaggedTip

This event is emitted when a tagged tip is made.

### logTaggedTipERC20

This event is emitted when a tagged ERC20 tip is made.

***

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

### getTippersFromMsgID

Returns a list of addresses that tipped a post and how much they tipped in MATIC.

| Parameter | Type    | Description                              |
| --------- | ------- | ---------------------------------------- |
| msgID     | uint256 | the message ID to get tips from          |
| startFrom | uint256 | the number to start getting records from |

```javascript
let msgID = 123;
let startFrom = 0;

const tippers = await contract.getTippersFromMsgID(msgID, startFrom);
console.log(tippers);
```

### checkTips

Checks to see how much in tips are owed to an address of a user or group.

| Parameter | Type    | Description                           |
| --------- | ------- | ------------------------------------- |
| addr      | address | the address to check for tips owed to |

```javascript
let addr = "0x...";
const tips = await contract.checkTips(addr);
console.log(tips);
```

### claimTips

Claims tips owed to an address (user or group). If you pass a group ID, then you must be the owner of the group to claim the tips.

| Parameter | Type    | Description                    |
| --------- | ------- | ------------------------------ |
| groupID   | uint256 | the group ID to claim tips for |

```javascript
let groupID = 123;

await contract.claimTips(groupID);
```

### addTipFromPost

Adds tips to a post. Tips are calculated from the value sent to this function.

| Parameter | Type    | Description                                |
| --------- | ------- | ------------------------------------------ |
| msgID     | uint256 | the message ID you want to add the tips to |

```javascript
let msgID = 123;
let value = ethers.utils.parseEther('0.1'); // 0.1 ether

await contract.addTipFromPost(msgID, {value: value});
```
