PartnerVesting
Last updated
Last updated
Inherits:, Context, Ownable2Step, ReentrancyGuard
Author: alexei@nebula-labs(dot)xyz
Manages linear token vesting for Lendefi partners
Implements a time-based linear vesting schedule with partner control and DAO cancellation capability
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 that created this contract (Ecosystem contract)
Running total of tokens that have been released
Restricts function access to the contract creator only
Used for cancellation functionality
Creates a new vesting contract for a partner
Sets the beneficiary as the owner, initializes immutable vesting parameters
Parameters
token
address
Address of the ERC20 token to be vested
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 creator
Returns
remainder
uint256
The amount of tokens returned to the creator
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
Returns
<none>
uint256
The start timestamp of the vesting period
Returns the duration of the vesting period
Returns
<none>
uint256
The duration in seconds of the vesting period
Returns the timestamp when vesting ends
Returns
<none>
uint256
The end timestamp of the vesting period
Returns the amount of tokens already released
Returns
<none>
uint256
The amount of tokens that have been released so far
Calculates the amount of tokens that can be released now
Returns
<none>
uint256
The amount of tokens currently available to be released
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
Verifies the caller is authorized to perform creator-only actions
Throws Unauthorized error if caller is not the creator