# Vesting V1 Guide

## Decubate Vesting V1 — User Guide

This guide covers the **V1 DecubateVesting** contract. If you are unsure which version you are on, see the Version Identification Guide.

***

### Prerequisites

* Your vesting contract address.
* A block explorer for your chain (e.g., Etherscan, BscScan).
* A wallet (e.g., MetaMask) connected to the correct network.
* You must be whitelisted in a vesting pool to claim tokens.

***

## Part 1: Investor Guide

This section is for investors who need to check their vesting status and claim tokens.

### 1.1 — Check If You Are Whitelisted

1. Go to your contract on the block explorer.
2. Navigate to **"Read Contract"**.
3. Find the function **`hasWhitelist`**.
4. Enter:
   * `_option`: Your vesting pool ID (usually `0` — ask your project admin if unsure).
   * `_wallet`: Your wallet address.
5. Click **Query**. If it returns `true`, you are whitelisted.

### 1.2 — Check Your Vesting Details

1. In **"Read Contract"**, find **`getWhitelist`**.
2. Enter:
   * `_option`: Your vesting pool ID.
   * `_wallet`: Your wallet address.
3. Click **Query**. You will see:
   * `wallet` — Your address.
   * `dcbAmount` — Your total token allocation (in wei). Divide by `10^18` for the human-readable amount.
   * `distributedAmount` — Tokens already claimed (in wei).
   * `joinDate` — Timestamp when you were added.
   * `revoke` — `true` if your vesting was revoked.
   * `disabled` — `true` if your claiming is temporarily disabled.

### 1.3 — Check How Many Tokens Are Vested

1. Find **`getVestAmount`** in "Read Contract".
2. Enter `_option` and `_wallet`.
3. The result is the total amount vested so far (in wei).

### 1.4 — Check Claimable (Releasable) Amount

1. Find **`getReleasableAmount`** in "Read Contract".
2. Enter `_option` and `_wallet`.
3. The result is the amount you can claim right now (in wei). This is: `vested amount - already claimed`.

### 1.5 — Claim Your Tokens

1. Navigate to **"Write Contract"**.
2. **Connect your wallet** by clicking "Connect to Web3".
3. Find the function **`claimDistribution`**.
4. Enter:
   * `_option`: Your vesting pool ID.
   * `_wallet`: Your wallet address.
5. Click **Write** and confirm the transaction in your wallet.
6. Once confirmed, the tokens will be sent to the wallet address you specified.

> **Note:** If `maxTokenTransfer` is active, you may not be able to claim all tokens at once. Repeat the claim if needed.

***

## Part 2: Admin / Founder Guide

This section is for the contract owner who manages vesting strategies and whitelists.

> **All write functions below require you to be the contract owner.**

### 2.1 — View All Vesting Pools

1. In **"Read Contract"**, call **`getAllVestingPools`**.
2. This returns an array of all strategies with: `name`, `cliff`, `start`, `duration`, `initialUnlockPercent`, `revocable`.

### 2.2 — View a Specific Vesting Pool

1. Call **`getVestingInfo`** with `_strategy` (pool index, starting from `0`).

#### Understanding the Fields

| Field                  | Description                                                               |
| ---------------------- | ------------------------------------------------------------------------- |
| `name`                 | Strategy name (e.g., "Seed Round").                                       |
| `start`                | Unix timestamp when vesting starts. Before this, no tokens are available. |
| `cliff`                | Unix timestamp when the cliff ends. After cliff, linear vesting begins.   |
| `duration`             | Duration (in seconds) of the linear vesting period after the cliff.       |
| `initialUnlockPercent` | Percentage unlocked at start (out of 1000, so `100` = 10%).               |
| `revocable`            | Whether the owner can revoke a user's vesting.                            |

### 2.3 — Add a New Vesting Strategy

1. Go to **"Write Contract"** and connect your wallet.
2. Call **`addVestingStrategy`** with:
   * `_name`: Strategy name.
   * `_cliff`: Cliff duration in seconds (added to `_start`).
   * `_start`: Unix timestamp for vesting start.
   * `_duration`: Linear vesting duration in seconds.
   * `_initialUnlockPercent`: Initial unlock out of 1000 (e.g., `100` = 10%).
   * `_revocable`: `true` or `false`.

### 2.4 — Update an Existing Vesting Strategy

1. Call **`setVestingStrategy`** with:
   * `_strategy`: Pool index.
   * All the same fields as `addVestingStrategy`.

> **Warning:** Changing a strategy affects all whitelisted users in that pool.

### 2.5 — Add a Single User to Whitelist

1. Call **`addWhitelist`** with:
   * `_wallet`: User's wallet address.
   * `_dcbAmount`: Total allocation in wei (e.g., 1000 tokens = `1000000000000000000000`).
   * `_option`: Vesting pool ID.

### 2.6 — Add Multiple Users (Batch)

1. Call **`batchAddWhitelist`** with:
   * `wallets`: Array of addresses, e.g., `["0xABC...", "0xDEF..."]`.
   * `amounts`: Array of amounts in wei (same order as wallets).
   * `option`: Vesting pool ID.

### 2.7 — Update a User's Allocation

1. Call **`setWhitelist`** with:
   * `_wallet`: User's address.
   * `_dcbAmount`: New allocation in wei.
   * `_option`: Vesting pool ID.

### 2.8 — Revoke a User's Vesting

This stops future vesting for a user. Any unclaimed but already-vested tokens are distributed before revoking.

1. Call **`revoke`** with:
   * `_option`: Vesting pool ID.
   * `_wallet`: User's address.

> The strategy must have `revocable` set to `true`.

### 2.9 — Enable / Disable a User's Claiming

Disabling prevents a user from claiming, but does not affect their vested balance.

1. Call **`setVesting`** with:
   * `_option`: Vesting pool ID.
   * `_wallet`: User's address.
   * `_status`: `true` to disable, `false` to re-enable.

### 2.10 — Set Max Token Transfer Limit

Limits how many tokens can be claimed in a single transaction.

1. Call **`setMaxTokenTransfer`** with:
   * `_amount`: Maximum amount in wei.
   * `_active`: `true` to enable, `false` to disable.

### 2.11 — Change the Token Address

1. Call **`setToken`** with `_addr` (new ERC-20 token address).

### 2.12 — Withdraw Tokens from the Contract

To recover tokens (including accidentally sent tokens):

1. Call **`transferToken`** with:
   * `_addr`: Token contract address.
   * `_amount`: Amount in wei.

Tokens are sent to the contract owner's address.

### 2.13 — View Whitelist for a Pool

1. In "Read Contract", call **`getWhitelistPool`** with `_option` (pool ID).
2. Returns the full array of whitelisted users and their details.

### 2.14 — Check Contract Token Balance

In "Read Contract", call getTotalToken with \_addr (the token contract address).\
Returns the total token balance held by the vesting 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://tms-finance.gitbook.io/tms.finance/vesting-contracts/vesting-v1-guide.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.
