Overview & Background
Currently, FlowFi only supports strict linear streaming, where tokens unlock continuously per second (rate_per_second). However, institutional grants, venture capital token distributions, and executive compensation packages frequently require milestone step-vesting (e.g. 25% unlock at 6 months, 25% at 12 months, followed by linear unlock for remaining tokens, or custom scheduled tranches).
Detailed Problem Statement
- Incompatibility with Milestone Grants:
- DAOs and protocols funding milestone-based development cannot model tranche releases within a single stream.
- Manual Fragmented Workarounds:
- Senders currently have to create separate individual streams for each milestone tranche, resulting in multiplied gas costs and fragmented tracking.
- Lack of Dynamic Schedule Verification:
- Recipient claimable calculations cannot evaluate discrete time-step unlock functions.
Technical Specification & Architecture
1. Milestone Vesting Step Model (types.rs)
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VestingStep {
pub unlock_time: u64,
pub unlock_amount: i128,
}
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum VestingSchedule {
Linear,
StepTranches(Vec<VestingStep>),
HybridCliffLinear { cliff_time: u64, cliff_unlock_amount: i128 },
}
2. Creation Entrypoint
pub fn create_step_vesting_stream(
env: Env,
sender: Address,
recipient: Address,
token_address: Address,
steps: Vec<VestingStep>,
) -> Result<u64, StreamError>
3. Claimable Calculation Engine
- At any timestamp $T$, total claimable amount equals the sum of
step.unlock_amount for all steps where step.unlock_time <= T, minus stream.withdrawn_amount.
- Cancellation rules: Senders can only refund steps where
step.unlock_time > cancellation_time.
Target Files
contracts/stream_contract/src/types.rs
contracts/stream_contract/src/lib.rs
contracts/stream_contract/src/test.rs
Acceptance Criteria
Overview & Background
Currently, FlowFi only supports strict linear streaming, where tokens unlock continuously per second (
rate_per_second). However, institutional grants, venture capital token distributions, and executive compensation packages frequently require milestone step-vesting (e.g. 25% unlock at 6 months, 25% at 12 months, followed by linear unlock for remaining tokens, or custom scheduled tranches).Detailed Problem Statement
Technical Specification & Architecture
1. Milestone Vesting Step Model (
types.rs)2. Creation Entrypoint
3. Claimable Calculation Engine
step.unlock_amountfor all steps wherestep.unlock_time <= T, minusstream.withdrawn_amount.step.unlock_time > cancellation_time.Target Files
contracts/stream_contract/src/types.rscontracts/stream_contract/src/lib.rscontracts/stream_contract/src/test.rsAcceptance Criteria