> For the complete documentation index, see [llms.txt](https://lendefidao.gitbook.io/lendefi-dao-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lendefidao.gitbook.io/lendefi-dao-docs/ecosystem/contract.investorvesting.md).

# InvestorVesting

[Git Source](https://github.com/nebula-labs-xyz/lendefi-dao/blob/7f0eb7a5b5767e3eed9a3c2d01ebe6a782dcd6dc/contracts/ecosystem/InvestorVesting.sol)

**Inherits:**[IVESTING](/lendefi-dao-docs/interfaces/interface.ivesting.md), Context, Ownable2Step, ReentrancyGuard

Investor Vesting contract

Offers flexible withdrawal schedule (gas efficient)

*Implements linear vesting schedule for investors*

**Note:**\
security-contact: <security@nebula-labs.xyz>

## State Variables

### \_start

*start timestamp*

```solidity
uint64 private immutable _start;
```

### \_duration

*duration seconds*

```solidity
uint64 private immutable _duration;
```

### \_token

*token address*

```solidity
address private immutable _token;
```

### \_erc20Released

*amount of tokens released*

```solidity
mapping(address token => uint256 amount) private _erc20Released;
```

## Functions

### constructor

*Sets the owner to beneficiary address, the start timestamp and the*\
*vesting duration of the vesting contract.*

```solidity
constructor(address token, address beneficiary, uint64 startTimestamp, uint64 durationSeconds) Ownable(beneficiary);
```

### release

*Release the tokens that have already vested.*\
*Emits a {ERC20Released} event.*

```solidity
function release() public virtual nonReentrant onlyOwner;
```

### start

*Getter for the start timestamp.*

```solidity
function start() public view virtual returns (uint256);
```

**Returns**

| Name     | Type      | Description     |
| -------- | --------- | --------------- |
| `<none>` | `uint256` | start timestamp |

### duration

*Getter for the vesting duration.*

```solidity
function duration() public view virtual returns (uint256);
```

**Returns**

| Name     | Type      | Description      |
| -------- | --------- | ---------------- |
| `<none>` | `uint256` | duration seconds |

### end

*Getter for the end timestamp.*

```solidity
function end() public view virtual returns (uint256);
```

**Returns**

| Name     | Type      | Description    |
| -------- | --------- | -------------- |
| `<none>` | `uint256` | end timnestamp |

### released

*Getter for the amount of token already released*

```solidity
function released() public view virtual returns (uint256);
```

**Returns**

| Name     | Type      | Description                      |
| -------- | --------- | -------------------------------- |
| `<none>` | `uint256` | amount of tokens released so far |

### releasable

*Getter for the amount of vested `ERC20` tokens.*

```solidity
function releasable() public view virtual returns (uint256);
```

**Returns**

| Name     | Type      | Description             |
| -------- | --------- | ----------------------- |
| `<none>` | `uint256` | amount of vested tokens |

### vestedAmount

*Calculates the amount of tokens that has already vested. Default implementation is a linear vesting curve.*

```solidity
function vestedAmount(uint64 timestamp) internal view virtual returns (uint256);
```

**Parameters**

| Name        | Type     | Description       |
| ----------- | -------- | ----------------- |
| `timestamp` | `uint64` | current timestamp |

**Returns**

| Name     | Type      | Description   |
| -------- | --------- | ------------- |
| `<none>` | `uint256` | amount vested |

### \_vestingSchedule

*Virtual implementation of the vesting formula. This returns the amount vested, as a function of time, for*\
*an asset given its total historical allocation.*

```solidity
function _vestingSchedule(uint256 totalAllocation, uint64 timestamp) internal view virtual returns (uint256);
```

**Parameters**

| Name              | Type      | Description       |
| ----------------- | --------- | ----------------- |
| `totalAllocation` | `uint256` | initial amount    |
| `timestamp`       | `uint64`  | current timestamp |

**Returns**

| Name     | Type      | Description   |
| -------- | --------- | ------------- |
| `<none>` | `uint256` | amount vested |
