Skip to content

[Contracts] Add stream_count view function #421

Description

@ogazboiz

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Labels: good first issue, contracts, Stellar Wave, smart-contract

There's no way to ask the contract how many streams exist, so the backend can't paginate without a full DB scan.

Add a read-only stream_count(env: Env) -> u64 that returns the global stream ID counter. That's the total number of streams ever created, not the active count. With it, the backend or any external indexer can do cursor/offset pagination without an extra roundtrip.

What the fix has to hold to

  • Returns the monotonic stream ID counter, not a filtered/active count
  • Doesn't panic on a fresh deploy, returns 0

Done when

  • stream_count(env: Env) -> u64 view is implemented
  • Returns 0 on a freshly-deployed contract
  • Unit test asserts the count goes up by 1 after each create_stream
  • TypeScript bindings regenerated
  • Tests + fmt pass, CI green

Where to start
Add the function in contracts/flowfi/src/lib.rs, test in contracts/flowfi/src/test.rs, then regen packages/sdk/src/index.ts. Small, good first contract issue.

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programcontractsSmart contract related tasksgood first issueGood for newcomerssmart-contractSoroban smart contract

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions