Skip to content
Lattice

VestingWallet

Git Source

Inherits: IVestingWallet

Title: VestingWallet

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/finance/VestingWallet.sol)

A Diamond facet that holds ETH/ERC20 tokens and releases them linearly over time to the Ownable beneficiary.

Stateless delegator — all logic and storage live in VestingWalletLib. Consumers should deploy this as a facet within a Diamond proxy alongside OwnableFacet. CUSTODY: the vesting allocation is the diamond's WHOLE balance, balanceOf(address(this)) + released, and anyone may call release. Do not cut it next to a module that holds the same asset (an ERC-4626 vault, BridgeERC20 or ShieldedPool escrow): once vesting ends, that module's funds go to the owner. One custodian per asset per diamond (issue #240).

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.1.0

Functions

start

Returns the start timestamp of the vesting schedule.

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

Returns

NameTypeDescription
<none>uint256The Unix timestamp at which vesting begins.

duration

Returns the duration of the vesting schedule in seconds.

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

Returns

NameTypeDescription
<none>uint256The total duration of the vesting period.

end

Returns the end timestamp of the vesting schedule.

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

Returns

NameTypeDescription
<none>uint256The Unix timestamp at which vesting completes (start + duration).

released

Returns the total amount of ETH already released.

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

Returns

NameTypeDescription
<none>uint256The cumulative ETH released to the beneficiary.

released

Returns the total amount of a specific ERC20 token already released.

function released(address token) public view virtual returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address.

Returns

NameTypeDescription
<none>uint256The cumulative token amount released to the beneficiary.

releasable

Returns the amount of ETH that can currently be released.

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

Returns

NameTypeDescription
<none>uint256The releasable ETH amount (vested minus already released).

releasable

Returns the amount of a specific ERC20 token that can currently be released.

function releasable(address token) public view virtual returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address.

Returns

NameTypeDescription
<none>uint256The releasable token amount (vested minus already released).

vestedAmount

Calculates the vested ETH amount at a given timestamp.

function vestedAmount(uint64 timestamp) public view virtual returns (uint256);

Parameters

NameTypeDescription
timestampuint64The Unix timestamp to evaluate the vesting schedule at.

Returns

NameTypeDescription
<none>uint256The total ETH that would be vested at the given timestamp.

vestedAmount

Calculates the vested ERC20 token amount at a given timestamp.

function vestedAmount(address token, uint64 timestamp) public view virtual returns (uint256);

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address.
timestampuint64The Unix timestamp to evaluate the vesting schedule at.

Returns

NameTypeDescription
<none>uint256The total token amount that would be vested at the given timestamp.

release

Releases all currently releasable ETH to the beneficiary.

Anyone may call this; funds always go to the beneficiary (owner). Emits an EtherReleased event.

function release() public virtual;

release

Releases all currently releasable tokens of a specific ERC20 to the beneficiary.

Anyone may call this; funds always go to the beneficiary (owner). Emits an ERC20Released event.

function release(address token) public virtual;

Parameters

NameTypeDescription
tokenaddressThe ERC20 token contract address to release.

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect VestingWallet methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: duration() 0x0fb5a6b4 end() 0xefbe1c1c releasable() 0xfbccedae releasable(address) 0xa3f8eace release() 0x86d1a69f release(address) 0x19165587 released() 0x96132521 released(address) 0x9852595c start() 0xbe9a6555 vestedAmount(address,uint64) 0x810ec23b vestedAmount(uint64) 0x0a17b06b

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes