Skip to content

Commit 82bff15

Browse files
Merge pull request #1165 from MinaProtocol/Shigoto-dev19-patch-cliff-time
Clarify cliffTime description
2 parents bc11c0d + fb6ce50 commit 82bff15

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

docs/zkapps/writing-a-zkapp/feature-overview/time-locked-accounts.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ As shown, the maximum amount of unlocked tokens is defined by the `initialMinimu
6060

6161
The other timing-related properties are:
6262

63-
- `cliffTime`: The initial time period during which all tokens are locked. Note that 'time' is measured in Mina by 'slots', where 1 slot is 3min.
63+
- `cliffTime`: The initial time period during which all tokens are locked (should be from the current slot onwards). Note that 'time' is measured in Mina by 'slots', where 1 slot is 3min.
6464
- `cliffAmount`: The quantity of tokens to be unlocked when the cliff time has elapsed. If this amount is greater or equal the 'initial minimum balance', all tokens are unlocked after the cliff time elapses.
6565
- `vestingPeriod`: After the cliff time elapses, tokens can be set to unlock periodically at a fixed interval, by a fixed quantity. The vesting period is the length of that interval.
6666
- `vestingIncrement`: The quantity of tokens that are unlocked after each vesting period elapses.
@@ -98,11 +98,14 @@ If you want all tokens to unlock after a certain time, then the only properties
9898
const tokensToLock = UInt64.from(10e9);
9999

100100
// calculate 1 week in slots
101-
const cliffTime = UInt32.from((60 / 3) * 24 * 7);
101+
const cliffPeriod = UInt32.from((60 / 3) * 24 * 7);
102+
103+
// fetch the current slot from the network
104+
const currentSlot = this.network.globalSlotSinceGenesis.get();
102105

103106
accountUpdate.account.timing.set({
104107
initialMinimumBalance: tokensToLock,
105-
cliffTime,
108+
cliffTime: currentSlot + cliffPeriod,
106109
cliffAmount: tokensToLock,
107110
vestingPeriod: UInt32.from(1), // 0 is not allowed; default value is 1
108111
vestingIncrement: UInt64.from(0),

0 commit comments

Comments
 (0)