LPsLux Proposals
Markets & DeFi
LP-9209

Token Streaming

Final

Per-second linear token transfer for payroll, subscriptions, and vesting, with each stream represented as a transferable NFT

Category
LRC
Created
2025-12-01

Abstract

Token Streaming enables continuous, per-second token transfers. A sender creates a stream by depositing tokens into the protocol, specifying a recipient and duration. Tokens flow linearly from sender to recipient over time. The recipient can withdraw accrued tokens at any point. Streams are cancellable by the sender (returning unvested tokens) or non-cancellable (irrevocable vesting).

Motivation

Payroll, subscriptions, and vesting are all the same shape — value that becomes yours gradually — and all three are usually faked with a monthly transfer and a promise. Streaming makes the accrual itself the primitive: the recipient's balance is a function of the clock, claimable at any instant, with no trusted party in between deciding whether this month's payment goes out.

Specification

Stream Model

struct Stream {
    address sender;
    address recipient;
    address token;
    uint256 deposit;        // total tokens deposited
    uint256 startTime;
    uint256 stopTime;
    uint256 withdrawn;      // tokens already withdrawn by recipient
    bool    cancelable;     // can sender cancel?
}

Streaming Rate

Tokens accrue linearly:

ratePerSecond = deposit / (stopTime - startTime)
balance(recipient) = ratePerSecond * (currentTime - startTime) - withdrawn
balance(sender) = deposit - ratePerSecond * (currentTime - startTime)

Operations

OperationDescription
createSender deposits tokens and creates a stream
withdrawRecipient withdraws accrued tokens
cancelSender cancels (if cancelable), refunds unvested portion
transferRecipient transfers stream ownership to another address

Stream Types

TypeCancelableUse Case
LinearyesPayroll, subscriptions
Linear (locked)noToken vesting, grants
Cliff + linearyes/noVesting with cliff (e.g., 1 year cliff + 3 year vest)

Cliff Vesting

A cliff stream has zero accrual until the cliff date, then linear accrual:

if currentTime < cliffTime:
    balance(recipient) = 0
else:
    balance(recipient) = cliffAmount + ratePerSecond * (currentTime - cliffTime) - withdrawn

Batch Operations

The protocol supports batch stream creation for payroll use cases:

function createBatch(StreamParams[] calldata params) external returns (uint256[] memory streamIds);

Employers can set up monthly payroll for all employees in a single transaction.

NFT Representation

Each stream is represented as an ERC-721 NFT (LP-3721). The NFT can be transferred, enabling secondary market trading of vested token streams.

Rationale

Ownership of a stream lives in an NFT rather than a mapping so that the future cash flow is itself an asset: it can be sold, used as collateral, or held in a vault without the protocol needing to know about any of those uses.

Security Considerations

  1. Rounding: per-second accrual can have rounding dust. The last second's withdrawal includes any remaining dust.
  2. Token compatibility: fee-on-transfer tokens are not supported (deposit amount must equal stream amount).
  3. Cancellation front-running: a sender cancelling a stream can be front-run by the recipient withdrawing. This is by design -- the recipient should always be able to claim vested tokens.

Reference

ResourceLocation
Streaming contractsgithub.com/luxfi/standard/contracts/streaming/
Stream factoryStreamFactory.sol
Batch operationsStreamBatch.sol
  • LP-3721 — the NFT that carries stream ownership
  • LP-9073 — batching many stream calls in one transaction

Copyright (C) 2024-2026, Lux Industries Inc. All rights reserved.

Licensed under the MIT License.