Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

VestingWalletCliff

Inherits: VestingWallet

Extension of {VestingWallet} that adds a cliff to the vesting schedule. Available since v5.1.

State Variables

_cliff

uint64 private immutable _cliff;

Functions

constructor

Set the duration of the cliff, in seconds. The cliff starts vesting schedule (see {VestingWallet}'s constructor) and ends cliffSeconds later.

constructor(uint64 cliffSeconds);

cliff

Getter for the cliff timestamp.

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

_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. Returns 0 if the cliff timestamp is not met. IMPORTANT: The cliff not only makes the schedule return 0, but it also ignores every possible side effect from calling the inherited implementation (i.e. super._vestingSchedule). Carefully consider this caveat if the overridden implementation of this function has any (e.g. writing to memory or reverting).

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

Errors

InvalidCliffDuration

The specified cliff duration is larger than the vesting duration.

error InvalidCliffDuration(uint64 cliffSeconds, uint64 durationSeconds);