Description
streampay-contracts does not build today. cargo build fails with error: this file contains an unclosed delimiter --> src/lib.rs:1459:3, pointing back to the impl StreamPayContract { opened at src/lib.rs:96 that is never closed. The file is a corrupted merge of several contract versions: it contains two #[contract] attributes (src/lib.rs:92 and src/lib.rs:225), two #[contractimpl] blocks (src/lib.rs:95 and src/lib.rs:228), three separate use soroban_sdk::{...} statements (src/lib.rs:44, :75, :178), a stray literal #### line at src/lib.rs:139, and module-level doc comments (//! ...) interleaved after code. This issue restores a single, coherent, compiling contract module.
Requirements and context
Functional
- Collapse the file down to exactly one
#[contract] pub struct StreamPayContract; and one #[contractimpl] impl StreamPayContract { ... } block with a single closing brace.
- Remove the stray
#### token at src/lib.rs:139 and the duplicate/partial first create_stream body (src/lib.rs:100–138).
- Consolidate the three
use soroban_sdk::{...} lines (src/lib.rs:44, :75, :178) into one import set that names only the symbols actually used by the retained implementation.
- Move all crate-level
//! doc comments to the top of the file (a //! doc comment is only valid before any item) and keep them as inner docs.
- Resolve which
StreamInfo is authoritative: src/lib.rs:207 defines one shape (token, claimable_balance, no memo/paused_at), src/stream.rs:28 defines a different shape, and src/lib.rs:76 imports StreamInfo from crate::stream. Pick one canonical definition (coordinate with the StreamInfo-consolidation issue) and delete the duplicate so the type resolves unambiguously.
Non-functional / repo conventions
- After the fix,
cargo build, cargo fmt --all -- --check, and cargo clippy --all-targets --all-features -- -D warnings must all pass (clippy is enforced by .github/workflows/contracts.yml).
- Do not silently drop public entry points that other docs promise (
create_stream, start_stream, stop_stream, settle_stream, batch_settle, withdraw_stream, archive_stream, get_stream_info, version); if a referenced helper such as emit_stream_created or settle_stream_amount is still undefined, gate or stub it behind a follow-up issue rather than leaving an unresolved symbol.
- Keep the release WASM within the budget verified by
scripts/check-wasm-size.sh.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b feature/fix-lib-compilation.
2. Implement changes — edit src/lib.rs: hoist the //! docs to the top, delete the partial first impl block (:95–:139), keep the second #[contractimpl] block, dedup the use lines, and align the StreamInfo type with src/stream.rs.
3. Write/extend tests — keep the inline #[cfg(test)] mod test in src/lib.rs; fix the duplicated create_stream call lines in tests (e.g. src/lib.rs:662–663, :781–:782) so each test calls the entry point exactly once with the canonical signature.
4. Test and commit
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo build
cargo test --features testutils
./scripts/check-wasm-size.sh
Example commit message
fix(contract): repair src/lib.rs corrupted merge so the crate compiles
Guidelines
- Target 95% line coverage for changed logic (
docs/coverage.sh, CONTRIBUTING.md §“Coverage guideline”).
- Update
/// doc-comments on every entry point you touch and reconcile docs/accrual-spec.md, docs/events.md, and docs/error-codes.md if the canonical surface shifts.
- Timeframe: 96 hours.
Description
streampay-contractsdoes not build today.cargo buildfails witherror: this file contains an unclosed delimiter --> src/lib.rs:1459:3, pointing back to theimpl StreamPayContract {opened atsrc/lib.rs:96that is never closed. The file is a corrupted merge of several contract versions: it contains two#[contract]attributes (src/lib.rs:92andsrc/lib.rs:225), two#[contractimpl]blocks (src/lib.rs:95andsrc/lib.rs:228), three separateuse soroban_sdk::{...}statements (src/lib.rs:44,:75,:178), a stray literal####line atsrc/lib.rs:139, and module-level doc comments (//! ...) interleaved after code. This issue restores a single, coherent, compiling contract module.Requirements and context
Functional
#[contract] pub struct StreamPayContract;and one#[contractimpl] impl StreamPayContract { ... }block with a single closing brace.####token atsrc/lib.rs:139and the duplicate/partial firstcreate_streambody (src/lib.rs:100–138).use soroban_sdk::{...}lines (src/lib.rs:44,:75,:178) into one import set that names only the symbols actually used by the retained implementation.//!doc comments to the top of the file (a//!doc comment is only valid before any item) and keep them as inner docs.StreamInfois authoritative:src/lib.rs:207defines one shape (token,claimable_balance, nomemo/paused_at),src/stream.rs:28defines a different shape, andsrc/lib.rs:76importsStreamInfofromcrate::stream. Pick one canonical definition (coordinate with the StreamInfo-consolidation issue) and delete the duplicate so the type resolves unambiguously.Non-functional / repo conventions
cargo build,cargo fmt --all -- --check, andcargo clippy --all-targets --all-features -- -D warningsmust all pass (clippy is enforced by.github/workflows/contracts.yml).create_stream,start_stream,stop_stream,settle_stream,batch_settle,withdraw_stream,archive_stream,get_stream_info,version); if a referenced helper such asemit_stream_createdorsettle_stream_amountis still undefined, gate or stub it behind a follow-up issue rather than leaving an unresolved symbol.scripts/check-wasm-size.sh.Acceptance criteria
cargo buildsucceeds with no errors and no warnings about unused imports.#[contract]and one#[contractimpl]block remain insrc/lib.rs.####line and all duplicatecreate_stream/StreamInfo/usefragments are removed.StreamInforesolves to a single definition (no “defined multiple times” or ambiguous-import error).cargo fmt --all -- --checkandcargo clippy --all-targets --all-features -- -D warningspass.cargo testcompiles and the previously-green tests run (vesting/event tests may be deferred to their dedicated issues).Suggested execution
1. Fork the repo and create a branch —
git checkout -b feature/fix-lib-compilation.2. Implement changes — edit
src/lib.rs: hoist the//!docs to the top, delete the partial first impl block (:95–:139), keep the second#[contractimpl]block, dedup theuselines, and align theStreamInfotype withsrc/stream.rs.3. Write/extend tests — keep the inline
#[cfg(test)] mod testinsrc/lib.rs; fix the duplicatedcreate_streamcall lines in tests (e.g.src/lib.rs:662–663,:781–:782) so each test calls the entry point exactly once with the canonical signature.4. Test and commit
cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo build cargo test --features testutils ./scripts/check-wasm-size.shExample commit message
Guidelines
docs/coverage.sh, CONTRIBUTING.md §“Coverage guideline”).///doc-comments on every entry point you touch and reconciledocs/accrual-spec.md,docs/events.md, anddocs/error-codes.mdif the canonical surface shifts.