Skip to content

Bug: withdrawableLocal diverges from the on-chain withdrawable for a stream paused past end_time #521

Description

@Jaydbrown

src/utils.ts:104-121withdrawableLocal computes effectiveNow as pause first, then end-time clamp:

const effectiveNow = stream.paused
  ? stream.pausedAt
  : stream.endTime > 0 && nowSec > stream.endTime ? stream.endTime : nowSec;

The on-chain math::streamed_amount (contracts/stream/src/math.rs) clamps to end_time before checking is_paused(), so once now > end_time a still-paused stream reports the full amount on-chain but the frozen-at-pausedAt amount locally. (See conduit-protocol/streamFi-contracts issue on the same ordering.)

Compounding this: per the parseStreamInfo flags bug, stream.paused is always false here anyway, so the pause branch is currently dead.

Impact

withdrawableLocal (used for optimistic UI balances without a contract call) can under-report by the full paused interval versus what withdraw() will actually release.

Suggested fix

Match whichever ordering the contract settles on, and fix parseStreamInfo so stream.paused is real.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingpriority: mediumMissing feature or UX issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions