# Vesting V2 Guide

This guide covers the **V2 DecubateVestingV2** contract (Ownable version). 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.

***

### Key Difference from V1

V2 supports **three vesting types**:

| Type       | Value | Description                                                   |
| ---------- | ----- | ------------------------------------------------------------- |
| `Linear`   | `0`   | Tokens vest continuously over time (same as V1).              |
| `Monthly`  | `1`   | Tokens unlock in fixed percentages on specific monthly dates. |
| `Interval` | `2`   | Tokens unlock in fixed percentages at regular time intervals. |

***

## 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 **`hasWhitelist`**.
4. Enter:
   * `_option`: Your vesting pool ID (usually `0` — ask your project admin if unsure).
   * `_wallet`: Your wallet address.
5. If it returns `true`, you are whitelisted.

### 1.2 — Check Your Vesting Details

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

### 1.3 — Understand Your Vesting Schedule

1. Call **`getVestingInfo`** with your pool ID (`_strategy`).
2. Key fields:
   * `vestType`: `0` = Linear, `1` = Monthly, `2` = Interval.
   * `initialUnlockPercent`: Percentage unlocked immediately (out of 1000, so `100` = 10%).
   * `start`: When vesting begins.
   * `cliff`: When tokens start unlocking beyond the initial amount.
   * `duration`: (Linear only) How long the linear vesting lasts.
   * `interval`: (Interval only) Time between each unlock.
   * `unlockPerInterval`: (Monthly/Interval) Percentage unlocked each period (out of 1000).
   * `timestamps`: (Monthly only) Array of exact unlock dates.

#### How Each Type Works

**Linear:** After the cliff, tokens vest smoothly every second until `cliff + duration`.

**Monthly:** After the cliff, a fixed percentage unlocks on each monthly date listed in `timestamps`.

**Interval:** After the cliff, a fixed percentage unlocks every `interval` seconds.

In all types, `initialUnlockPercent` is available as soon as the `start` time passes.

### 1.4 — Check How Many Tokens Are Vested

1. Find **`getVestAmount`** in "Read Contract".
2. Enter `_option` and `_wallet`.
3. The result is total tokens vested to date (in wei).

### 1.5 — Check Claimable (Releasable) Amount

1. Find **`getReleasableAmount`**.
2. Enter `_option` and `_wallet`.
3. The result is: `vested - already claimed` (in wei).

### 1.6 — Claim Your Tokens

1. Navigate to **"Write Contract"**.
2. **Connect your wallet** by clicking "Connect to Web3".
3. Find **`claimDistribution`**.
4. Enter:
   * `_option`: Your vesting pool ID.
   * `_wallet`: Your wallet address.
5. Click **Write** and confirm the transaction.

> **Note:** If `maxTokenTransfer` is active, you may need to claim multiple times.

***

## Part 2: Admin / Founder Guide

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

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

### 2.1 — View All Vesting Pools

1. In "Read Contract", call **`getAllVestingPools`**.
2. Returns all strategies with their full configuration.

### 2.2 — View a Specific Pool

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

### 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`: Vesting duration in seconds (used for Linear type).
   * `_initialUnlockPercent`: Initial unlock out of 1000 (e.g., `100` = 10%).
   * `_revocable`: `true` or `false`.
   * `_interval`: Time between unlocks in seconds (Interval type only, set `0` for others).
   * `_unlockPerInterval`: Percentage per unlock out of 1000 (Interval/Monthly, set `0` for Linear).
   * `_monthGap`: Number of months between unlocks (Monthly type only, set `0` for others).
   * `_type`: `0` = Linear, `1` = Monthly, `2` = Interval.

#### Example: Linear Vesting

```
_name: "Seed Round"
_cliff: 2592000          (30 days)
_start: 1700000000       (Unix timestamp)
_duration: 15552000      (180 days)
_initialUnlockPercent: 100   (10%)
_revocable: true
_interval: 0
_unlockPerInterval: 0
_monthGap: 0
_type: 0
```

#### Example: Monthly Vesting

```
_name: "Team Allocation"
_cliff: 7776000          (90 days)
_start: 1700000000
_duration: 0             (not used for Monthly)
_initialUnlockPercent: 50    (5%)
_revocable: false
_interval: 0
_unlockPerInterval: 100  (10% per month)
_monthGap: 1             (every 1 month)
_type: 1
```

#### Example: Interval Vesting

```
_name: "Advisor Pool"
_cliff: 2592000          (30 days)
_start: 1700000000
_duration: 0             (not used for Interval)
_initialUnlockPercent: 0     (0%)
_revocable: true
_interval: 604800        (7 days)
_unlockPerInterval: 50   (5% per interval)
_monthGap: 0
_type: 2
```

### 2.4 — Update an Existing Vesting Strategy

1. Call **`setVestingStrategy`** with:
   * `_strategy`: Pool index.
   * All fields as in `addVestingStrategy` (except `_monthGap` and `_type`).

> **Important:** Monthly strategies **cannot** be updated. Only Linear and Interval strategies can be modified.

### 2.5 — Add a Single User to Whitelist

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

### 2.6 — Add Multiple Users (Batch)

1. Call **`batchAddWhitelist`** with:
   * `wallets`: Array of addresses.
   * `amounts`: Array of amounts in wei.
   * `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

1. Call **`revoke`** with `_option` and `_wallet`.
2. Any vested but unclaimed tokens are automatically distributed before revoking.

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

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

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

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

### 2.11 — Change the Token Address

1. Call **`setToken`** with `_addr`.

### 2.12 — Withdraw Tokens from the Contract

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

Tokens are sent to the contract owner.

### 2.13 — View Whitelist for a Pool

1. Call **`getWhitelistPool`** with `_option`.

### 2.14 — Check Contract Token Balance

1. Call **`getTotalToken`** with `_addr` (token contract address).


---

# 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-v2-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.
