Skip to content

Presets and Actuals

In 2.7.7 both structs are defined in TTUDataModels.sol (TokenTableUnlockerV2DataModels.sol in npm package 2.7.0). The fields are the same in both versions.

Preset

A Preset is an unlocking schedule template with the information shared by all stakeholders in a single round.

Cliffs are modeled as linear segments too, so a preset can combine cliffs and linear unlocks in any order. A cliff waiting period is a segment that unlocks 0 basis points, and a cliff unlock is a segment that lasts 1 second.

Relative timestamps are relative to the absolute start timestamp. Absolute timestamps are standard UNIX epoch timestamps in seconds.

  • linearStartTimestampsRelative: the start timestamp of each linear segment.
  • linearEndTimestampRelative: the end timestamp of the final linear segment.
  • linearBips: the basis points unlocked in each linear segment. They must add up to TTUnlocker.BIPS_PRECISION() (10000).
  • numOfUnlocksForEachLinear: the number of unlocks in each linear segment.
  • stream: whether tokens unlock as a stream instead of all at once at the end of each subdivision of a linear segment.
struct Preset {
  uint256[] linearStartTimestampsRelative;
  uint256 linearEndTimestampRelative;
  uint256[] linearBips;
  uint256[] numOfUnlocksForEachLinear;
  bool stream;
}

createPresets rejects a preset with InvalidPresetFormat unless:

  • linearStartTimestampsRelative, linearBips and numOfUnlocksForEachLinear have the same length,
  • linearBips adds up to 10000,
  • the last value of linearStartTimestampsRelative is less than linearEndTimestampRelative, and
  • every segment lasts at least as many seconds as its number of unlocks.

Start timestamps that are not strictly increasing also make the call revert. A numOfUnlocksForEachLinear value of 0 reverts with a division-by-zero panic. When stream is true, numOfUnlocksForEachLinear is ignored and each segment unlocks once per second.

Actual

An Actual is the unlocking schedule of a single stakeholder. It builds on an existing preset and holds the details that differ from one stakeholder to the next.

  • presetId: the ID of the Preset this Actual uses.
  • startTimestampAbsolute: when this unlocking schedule starts.
  • amountClaimed: the amount of tokens the recipient has already claimed.
  • totalAmount: the maximum amount of tokens the recipient can claim over the whole schedule.
struct Actual {
  bytes32 presetId;
  uint256 startTimestampAbsolute;
  uint256 amountClaimed;
  uint256 totalAmount;
}

amountClaimed must be less than totalAmount, otherwise createActuals reverts with InvalidSkipAmount. When an actual is canceled it is deleted, so actuals(actualId) returns an empty struct afterwards.