# Vesting Contracts

### Key Features

* **Flexible Vesting Schedules**: Configure start time, cliff period, duration, and release intervals
* **Access Control**: Role-based permissions for administrative functions
* **Safety Features**: Includes reentrancy protection and pausable functionality
* **Virtual Token**: ERC20-compatible representation of vested tokens (non-transferable)
* **Merkle Tree Support**: Efficient distribution of vesting schedules
* **Purchase Options**: Optional ETH payment for vesting schedule creation

{% embed url="<https://github.com/bio-xyz/vesting-contracts>" %}

## Contracts

### TokenVesting Contract

The base vesting contract that implements core vesting functionality and virtual token features.

**Features**

* **Vesting Schedule Management**:
  * Configurable start time, cliff period, and duration
  * Customizable slice periods for gradual token release
  * Optional revocability per schedule
  * Admin controls for schedule management
* **Virtual Token Implementation**:
  * ERC20-compatible interface
  * Non-transferable by design
  * Balance represents vested tokens
  * Automatic balance updates on vesting events
* **Access Control**:
  * `DEFAULT_ADMIN_ROLE`: Can manage vesting schedules and contract settings
  * `VESTING_CREATOR_ROLE`: Can create new vesting schedules

**Inheritance**

* OpenZeppelin's AccessControlDefaultAdminRules
* OpenZeppelin's ReentrancyGuard
* OpenZeppelin's Pausable
* IERC20Metadata

**Key Functions**

* `createVestingSchedule()`: Creates new vesting schedules
* `release()`: Releases vested tokens to beneficiaries
* `revoke()`: Allows admin to revoke revocable schedules
* `withdraw()`: Enables admin to withdraw unused tokens

**Security Features**

* Reentrancy protection on critical functions
* Pausable functionality for emergency stops
* Role-based access control
* Comprehensive input validation

### TokenVestingMerkle Contract

Extends TokenVesting with Merkle tree functionality for efficient schedule distribution.

**Features**

* **Merkle Tree Integration**:
  * Efficient proof verification
  * Prevention of double-claiming
  * Batch schedule distribution support

**Inheritance**

* TokenVesting

**Key Functions**

* `claimSchedule()`: Claims vesting schedule using Merkle proof
* `updateMerkleRoot()`: Updates the Merkle root
* `scheduleClaimed()`: Checks if a schedule has been claimed

### TokenVestingMerklePurchasable Contract

Extends TokenVestingMerkle with purchasing capabilities.

**Features**

* **Purchase Mechanism**:
  * ETH payments for vesting schedules
  * Configurable cost per vToken
  * Customizable payment receiver

**Inheritance**

* TokenVestingMerkle

**Key Functions**

* `claimSchedule()`: Claims schedule with payment
* `setVTokenCost()`: Updates the cost per vToken
* `setPaymentReceiver()`: Sets payment receiver address

### Deprecated Contracts

Located in `src/deprecated/`:

**MultiTokenVesting**

* Enables querying vesting balances across multiple contracts
* Supports external vesting contract integration

**MultiTokenVestingMerklePurchasable**

* Combines MultiTokenVesting and TokenVestingMerklePurchasable
* Supports cross-contract schedule verification


---

# 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.bio.xyz/bio/developers/dao-setup/evm-contracts/vesting-contracts.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.
