Larzscript Flagship Projects

LarzVest — Cliff + Linear-Unlock Vesting, Built in Larzscript

Every vest has a cliff and a duration — nothing is withdrawable until the cliff passes. After that, the vested ceiling grows every single second, computed live from real elapsed time — a require against a continuously moving target, not a fixed balance.

What LarzVest actually does

Each vest locks its full amount into escrow the instant it's created. vested_amount(v, now) returns $0 before the cliff, then ramps linearly toward the full grant as the duration elapses — withdraw() refuses anything above that live ceiling with a real RequireError. revoke() returns whatever hasn't vested yet to the grantor.

Every line below is the real output of a fresh run against the actual interpreter — re-run fresh for this page, not copied from documentation. Alice's cliff is still far away; Bob's cliff just cleared but his duration is long.

vest.withdraw(alice_grant, $1)    # cliff far ahead
vest.withdraw(bob_grant, $1000)   # cliff cleared, full grant
vest.withdraw(bob_grant, $1)      # cliff cleared, modest amount
Output
error: exceeds what has vested so far (available: $0)
error: exceeds what has vested so far (available: $20)
withdrew $1  (total withdrawn so far: $1)

Alice can't touch a single dollar before her cliff, no matter how small the ask. Bob's cliff cleared, so something has vested — but his duration is long, so the full $1000 is still refused; only the small amount actually within his live-computed ceiling goes through.

vest.withdraw(carol_grant, $500)  # duration fully elapsed
vest.revoke(dave_grant)           # before his cliff
Output
withdrew $500  (total withdrawn so far: $500)
carol: $500
revoked - $700 of unvested funds returned to the grantor
company: $7500

Carol waited past her whole duration, so her entire grant is vested — a real, full withdrawal. Dave leaves before his cliff clears, so his whole $700 is still unvested and comes straight back to the grantor on revoke, the same require-refused-by-default mechanism the course's error-handling lesson covers.

Why it matters

A continuously time-varying check doesn't sit well with "diff real output against a fixed expected file" testing — the exact vested amount at any instant depends on exactly how much wall-clock time elapsed. Every case above is a saturated boundary instead: always $0 vested, always 100% vested, or always far more than could possibly have vested yet — so a little CLI-startup jitter can never flip the outcome. wallet, pay, and require are the same money-native core the course's Money-Native Basics lesson teaches — here composed into a real ceiling that moves on its own, every second.

View source on GitHubFlagship ProjectsLarzscript Course