InvestorVesting

Git Source

Inherits:IVESTING, 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

uint64 private immutable _start;

_duration

duration seconds

uint64 private immutable _duration;

_token

token address

address private immutable _token;

_erc20Released

amount of tokens released

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.

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

release

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

function release() public virtual nonReentrant onlyOwner;

start

Getter for the start timestamp.

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

Returns

Name
Type
Description

<none>

uint256

start timestamp

duration

Getter for the vesting duration.

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

Returns

Name
Type
Description

<none>

uint256

duration seconds

end

Getter for the end timestamp.

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

Returns

Name
Type
Description

<none>

uint256

end timnestamp

released

Getter for the amount of token already released

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.

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.

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.

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

Last updated