Skip to content

fix: improve lock vs vesting classification#344

Merged
dperdic-streamflow merged 3 commits intomasterfrom
fix/add-additional-checks-for-locks
Mar 9, 2026
Merged

fix: improve lock vs vesting classification#344
dperdic-streamflow merged 3 commits intomasterfrom
fix/add-additional-checks-for-locks

Conversation

@dperdic-streamflow
Copy link
Copy Markdown
Contributor

@dperdic-streamflow dperdic-streamflow commented Mar 9, 2026

The root cause was that isTokenLock in the SDK only checked the cliff amount (if it is close to the deposited amount) but never checked the cliff  time (if it is close to the end date). So a contract that unlocks 100% of tokens at creation but has an end date a year later still passed the lock check.
The fix adds a time based validation to isTokenLock and buildStreamType in packages/stream/solana/contractUtils.ts. When a contract is identified as a lock via the cliff-amount path, it now also verifies that the gap between the cliff timestamp and end timestamp is no more than 1 second. Legitimate locks created through our app have a gap of 1 second, so this threshold has wide margin. If the gap exceeds 1 second, the contract is reclassified as vesting - which means the UI will show the correct unlock schedule instead of a misleading lock date.
The cliff and end fields were added as optional parameters to keep backward compatibility - external callers that don't pass them get the same behavior as before. Dynamic locks (classified via the price/percentage path) are completely unaffected.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

Alpha versions of packages are published 📦

PR: #344
Version: 11.2.1-alpha.p344.0043a55
NPM: https://www.npmjs.com/package/@streamflow/common/v/11.2.1-alpha.p344.0043a55

@dperdic-streamflow dperdic-streamflow merged commit d37680d into master Mar 9, 2026
8 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants