Skip to content

Fix non-compiling callora-revenue-pool — undefined PAUSED_KEY / ERR_PAUSED constants and document the pause API #401

@greatest0fallt1me

Description

@greatest0fallt1me

Description

callora-revenue-pool does not compile. cargo check -p callora-revenue-pool fails with five error[E0425]: cannot find value errors because the pause implementation references two constants — PAUSED_KEY and ERR_PAUSED — that are used in contracts/revenue_pool/src/lib.rs (:185, :188, :211, :235, :246) but never declared. The neighbouring constants (ADMIN_KEY, ERR_UNAUTHORIZED, etc.) are declared together at the top of the file (contracts/revenue_pool/src/lib.rs:16:26); these two were simply omitted.

The pause feature itself is fully implemented — pause, unpause, is_paused, and the require_not_paused guard on distribute / batch_distribute all exist — so this is purely a missing-declaration fix plus the documentation that should have shipped with it.

Requirements and context

Functional

  • Declare the two missing string constants alongside the existing ones in contracts/revenue_pool/src/lib.rs (near :16:26):
    • const PAUSED_KEY: &str = "paused"; — the instance-storage symbol key used by pause/unpause/is_paused.
    • const ERR_PAUSED: &str = "revenue pool is paused"; — the panic message used by require_not_paused (:188).
  • The chosen PAUSED_KEY value must be a fresh, unused instance-storage key (it must not collide with ADMIN_KEY, PENDING_ADMIN_KEY, USDC_KEY, MAX_DISTRIBUTE_KEY, or VERSION_KEY).
  • The pause_set event already emitted by pause/unpause (contracts/revenue_pool/src/lib.rs:213 / :237) is not documented in EVENT_SCHEMA.md — add it.

Non-functional / repo conventions

  • No behavioral change beyond making the code build: distribute and batch_distribute already call Self::require_not_paused(&env) (:343, :458); once the constants exist these guards must function and stay tested.
  • Follow the existing constant style in the file (string keys via Symbol::new(&env, KEY)), consistent with claim_admin / set_admin.

Acceptance criteria

  • cargo check -p callora-revenue-pool and cargo build --workspace succeed.
  • PAUSED_KEY and ERR_PAUSED are declared once, with a PAUSED_KEY value that does not collide with any other storage key.
  • cargo test --workspace passes; pause/unpause and "distribute while paused panics" behavior is exercised in contracts/revenue_pool/src/test.rs.
  • EVENT_SCHEMA.md documents the pause_set event (topic "pause_set", topic 1 caller, data bool) and adds it to the indexer quick-reference table.
  • cargo clippy --all-targets --all-features -- -D warnings is clean.

Suggested execution

1. Fork the repo and create a branch

git checkout -b fix/revenue-pool-paused-constants

2. Implement changes

  • contracts/revenue_pool/src/lib.rs — add the two const declarations next to the existing constants block.
  • EVENT_SCHEMA.md — add a pause_set section under Contract: callora-revenue-pool and a row in the indexer quick-reference table.

3. Write/extend tests

  • In contracts/revenue_pool/src/test.rs add (or confirm) tests: pause then is_paused()==true; distribute while paused panics with ERR_PAUSED; batch_distribute while paused panics; unpause restores both; double-pause / unpause-when-not-paused panic paths.

4. Test and commit

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --workspace
./scripts/check-wasm-size.sh
./scripts/coverage.sh

Example commit message

fix(revenue-pool): declare missing PAUSED_KEY/ERR_PAUSED constants

Pause/unpause referenced two undeclared constants, breaking compilation
(E0425). Add them next to the existing constant block and document the
pause_set event in EVENT_SCHEMA.md.

Guidelines

  • Coverage must stay >= 95% (scripts/coverage.sh), CI-enforced via .github/workflows/coverage.yml.
  • Add NatSpec-style /// docs if you touch any entrypoint; keep EVENT_SCHEMA.md authoritative for the pause_set event.
  • Timeframe: 96 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GRANTFOX OSSGrantFox OSS programMAYBE REWARDEDGrantFox — potentially rewardedOFFICIAL CAMPAIGNGrantFox official campaignciCI / build pipelinegood first issueGood for newcomersimprovementRefactor, performance, or tech-debtsmart-contractSoroban / Rust contract work

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions