Logo Aflos Aflos Documentation aflos.xyz
Dokumentasi/Whitepaper

Vesting & locking

The one-contract-per-lock architecture.

Locking uses a one contract per lock pattern. Every time you lock, a new contract is issued specifically for that lock — so each schedule has its own address that anyone can inspect without reading the logic of a large contract.

Factory and vault

AflosVestingFactory            factory, no owner
   |
   +-- AflosVestingVault       a new contract per lock
          IMMUTABLE parameters: token, tokenId, beneficiary,
                                creator, start, cliff, duration, mode
          release() -> can ONLY send to the beneficiary
The factory mayThe factory may not
Issue a new vaultHold assets, even briefly
Call sync() once, right after fundingCall sync() twice
Trigger release(), which still sends to the beneficiaryWithdraw assets from any vault
 Change a schedule that already exists

Schedule parameters

ParameterMeaning
startWhen counting begins. 0 means now. A past date is allowed.
cliffWaiting period. Before start + cliff, 0% can be released.
durationLength of the linear release. 0 means fully unlocked at the end of the cliff.
modeAfterCliff: linear after the cliff. Retroactive: linear counted from start.
cliff 12 months + duration 36 months + AfterCliff
   -> 0% until month 12, then linear, 100% at month 48

cliff 12 months + duration 48 months + Retroactive
   -> 25% right at month 12, then linear, 100% at month 48

Releasing assets

// release one lock
AflosVestingVault(vault).release();

// through the factory
factory.release(id);
factory.releaseBatch([0, 1, 2]);

// reading
factory.vaultAt(id);           // the vault address
factory.vaultsOf(beneficiary); // every vault owned by someone

release() may be called by anyone. The assets are always sent to the recorded beneficiary, so triggering it gives the caller no advantage. This is deliberate: if the recipient is inactive, anyone can help release the assets.

🛑
Never send assets directly to a vault address. Only locking through the factory is recorded as a schedule. Assets that arrive via a plain transfer are not tied to any schedule and can never be taken out again, because the contract deliberately has no rescue function.