TeamVesting
Last updated
Last updated
Inherits:, Context, Ownable2Step, ReentrancyGuard
Cancellable Vesting contract
Offers flexible withdrawal schedule (gas efficient)
Implements secure linear vesting for the DAO team
Note: security-contact: security@nebula-labs.xyz
Start timestamp of the vesting period
Duration of the vesting period in seconds
Address of the token being vested
Address of the timelock controller that can cancel vesting
Running total of tokens that have been released
Restricts function access to the timelock controller only
Used for cancellation functionality
Creates a new vesting contract for a team member
Sets the beneficiary as the owner, initializes immutable vesting parameters
Parameters
token
address
Address of the ERC20 token to be vested
timelock
address
Address of the timelock controller
beneficiary
address
Address that will receive the vested tokens
startTimestamp
uint64
UNIX timestamp when vesting begins
durationSeconds
uint64
Duration of vesting period in seconds
Cancels the vesting contract, releasing vested tokens and returning unvested tokens
First releases any vested tokens to the beneficiary, then returns remaining tokens to timelock
Returns
remainder
uint256
The amount of unvested tokens returned to the timelock
Releases vested tokens to the beneficiary
Can be called by anyone but tokens are always sent to the owner (beneficiary)
Returns the timestamp when vesting starts
This value is immutable and set during contract creation
Returns
<none>
uint256
The start timestamp of the vesting period
Returns the duration of the vesting period
This value is immutable and set during contract creation
Returns
<none>
uint256
The duration in seconds of the vesting period
Returns the timestamp when vesting ends
Calculated as start() + duration()
Returns
<none>
uint256
The end timestamp of the vesting period
Returns the amount of tokens already released
Used in vesting calculations to determine how many more tokens can be released
Returns
<none>
uint256
The amount of tokens that have been released so far
Calculates the amount of tokens that can be released now
Subtracts already released tokens from the total vested amount
Returns
<none>
uint256
The amount of tokens currently available to be released
Verifies the caller is the timelock controller
Throws Unauthorized error if caller is not the timelock
Calculates the amount of tokens that have vested by a given timestamp
Internal function used by releasable()
Parameters
timestamp
uint64
The timestamp to calculate vested amount for
Returns
<none>
uint256
The total amount of tokens vested at the specified timestamp
Calculates vested tokens according to the linear vesting schedule
Implements the core vesting calculation logic
Parameters
totalAllocation
uint256
Total token allocation (current balance + already released)
timestamp
uint64
The timestamp to calculate vested amount for
Returns
<none>
uint256
The amount of tokens vested at the specified timestamp