Vesting Scheduler
Automated vesting schedule management for Super Tokens
The Vesting Scheduler enables creation and management of token vesting schedules using Superfluid streams. It automates the complex task of implementing cliff periods, vesting durations, and automatic stream management.
Overview
Vesting Scheduler provides:
- Cliff and vesting period configuration
- Automatic stream creation and termination
- Early termination with unvested token clawback
- Batch vesting schedule creation
- Integration with existing Superfluid infrastructure
Read Functions
getVestingSchedule
Returns details of a vesting schedule.
import { useReadVestingScheduler } from '@sfpro/sdk/hook/automation';
const { data: schedule } = useReadVestingScheduler({
address: '0x...',
functionName: 'getVestingSchedule',
args: [superToken, sender, receiver],
});
import { vestingScheduler } from '@sfpro/sdk/abi/automation';
const schedule = await client.readContract({
address: '0x...',
abi: vestingScheduler,
functionName: 'getVestingSchedule',
args: [superToken, sender, receiver],
});
import { readVestingScheduler } from '@sfpro/sdk/action/automation';
const schedule = await readVestingScheduler(client, {
address: '0x...',
functionName: 'getVestingSchedule',
args: [superToken, sender, receiver],
});
getMaxVestingDuration
Returns the maximum allowed vesting duration.
getRemainingVestingAmount
Calculates the remaining amount to be vested.
Write Functions
createVestingSchedule
Creates a new vesting schedule with cliff and vesting periods.
import { useWriteVestingScheduler } from '@sfpro/sdk/hook/automation';
const { writeContract } = useWriteVestingScheduler();
await writeContract({
address: '0x...',
functionName: 'createVestingSchedule',
args: [
superToken,
receiver,
startDate,
cliffDate,
flowRate,
cliffAmount,
endDate,
userData
],
});
import { vestingScheduler } from '@sfpro/sdk/abi/automation';
const hash = await client.writeContract({
address: '0x...',
abi: vestingScheduler,
functionName: 'createVestingSchedule',
args: [
superToken,
receiver,
startDate,
cliffDate,
flowRate,
cliffAmount,
endDate,
userData
],
});
import { writeVestingScheduler } from '@sfpro/sdk/action/automation';
const hash = await writeVestingScheduler(client, {
address: '0x...',
functionName: 'createVestingSchedule',
args: [
superToken,
receiver,
startDate,
cliffDate,
flowRate,
cliffAmount,
endDate,
userData
],
});
createVestingScheduleFromAmountAndDuration
Creates a vesting schedule by specifying total amount and duration.
updateVestingSchedule
Updates an existing vesting schedule (admin only).
deleteVestingSchedule
Terminates a vesting schedule early and returns unvested tokens.
executeCliff
Triggers the cliff payment for a vesting schedule.
executeEndVesting
Ends the vesting stream when the schedule completes.
Vesting Parameters
- startDate: When the vesting begins
- cliffDate: When the cliff period ends
- cliffAmount: Lump sum paid at cliff
- flowRate: Rate of vesting after cliff
- endDate: When vesting completes
- remainderAmount: Final payment at end
Related
- Flow Scheduler - Schedule regular streams
- CFA - Underlying streaming mechanism
- Super Token - Tokens being vested