Skip to content

maintenance-pool::withdraw panics (not a typed error) if Treasury is missing — require_treasury().unwrap() #488

Open

Description

@chonilius

Problem

withdraw uses require_treasury::<DataKey>(&env).unwrap() as well.

Suggested fix

Return Error::NotInitialized instead.

Related: #7

Activity

  1. urielit1313-creator commented on Oct 14, 2026

    @urielit1313-creator

    Addressed in PR #628.

    Summary

    • Replaced require_treasury::<DataKey>(&env).unwrap() with require_treasury::<DataKey>(&env).ok_or(Error::NotInitialized)? in maintenance-pool::withdraw, eliminating the unhandled host panic.
    • Added unit test test_withdraw_returns_not_initialized_if_treasury_missing verifying Err(Ok(Error::NotInitialized)) is cleanly returned when Treasury is missing.
    • 100% test pass rate across mergefi-maintenance-pool (43 tests passed) and 0 Clippy warnings.

    Bounty Payout Address (Base USDC): 0xfE777c43e4B0A24fFA1527eD520d1E7f9ECED483

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions