📌 Description
min_liquidity(env, asset) and storage::get_min_liquidity both default to 0 via unwrap_or(0) when no entry exists, so a floor that was explicitly set to 0 (disabling the check on purpose) is indistinguishable from an asset the admin never configured at all. set_min_liquidity even documents 0 as "the default" that "disables the check entirely," which only sharpens the ambiguity for an audit trail.
🧩 Requirements and context
- Add a
has_min_liquidity accessor in src/storage.rs using env.storage().persistent().has(&DataKey::MinLiquidity(asset)).
- Expose
is_min_liquidity_configured(env, asset) -> bool on the contract, delegating to the new storage helper.
- Add regression tests distinguishing never-configured vs. explicitly-zeroed floors.
🛠️ Suggested execution
- Add
has_min_liquidity next to get_min_liquidity/set_min_liquidity in src/storage.rs.
- Add the public entrypoint in
src/lib.rs.
- Add tests in
src/test.rs covering: never called, called with a nonzero floor, called with an explicit 0.
✅ Acceptance criteria
🔒 Security notes
Distinguishing an intentional zero-floor from a never-configured one gives auditors and off-chain monitoring a way to flag an admin action that silently disabled a fund-safety guard, rather than assuming the guard was simply never used.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
min_liquidity(env, asset)andstorage::get_min_liquidityboth default to0viaunwrap_or(0)when no entry exists, so a floor that was explicitly set to0(disabling the check on purpose) is indistinguishable from an asset the admin never configured at all.set_min_liquidityeven documents0as "the default" that "disables the check entirely," which only sharpens the ambiguity for an audit trail.🧩 Requirements and context
has_min_liquidityaccessor insrc/storage.rsusingenv.storage().persistent().has(&DataKey::MinLiquidity(asset)).is_min_liquidity_configured(env, asset) -> boolon the contract, delegating to the new storage helper.🛠️ Suggested execution
has_min_liquiditynext toget_min_liquidity/set_min_liquidityinsrc/storage.rs.src/lib.rs.src/test.rscovering: never called, called with a nonzero floor, called with an explicit0.✅ Acceptance criteria
is_min_liquidity_configuredisfalsebefore anyset_min_liquiditycall for that asset.trueafterset_min_liquidity(asset, 0)even thoughmin_liquidity(asset)still reads0.min_liquidity/set_min_liquiditybehavior is unchanged.🔒 Security notes
Distinguishing an intentional zero-floor from a never-configured one gives auditors and off-chain monitoring a way to flag an admin action that silently disabled a fund-safety guard, rather than assuming the guard was simply never used.
📋 Guidelines