Pattern: Hold Period (Lock-Up)
Create a token with a mandatory holding period before transfers are allowed
Overview
The hold period hook enforces a lock-up duration after token acquisition. Investors cannot transfer tokens until the lock-up expires. Common for private placements and vesting schedules.
Implementation
Key Points
recordAcquisition()must be called when tokens are distributed to set the lock timerunlockAt = now + holdPeriodSeconds— computed at acquisition timeupdateHoldPeriod()changes the duration for future acquisitions only, existing locks are unaffectedisUnlocked()returnstrueif no lock exists (e.g., wallet never acquired)- Use
toggleActive(false)to temporarily bypass all hold period checks