Problem Statement
Several DEX view functions compute utilisation that can divide by zero on a fresh pool.
Why it matters
Reliability.
Technical Context
Add a guarded divide with explicit ZeroLiquidity errors.
Expected Outcome
Zero liquidity returns clean error rather than aborting.
Acceptance Criteria
- Tests cover empty pools.
ZeroLiquidity error defined.
- SDK reflects.
Implementation Notes
Add is_zero checks.
Files or modules likely to be affected
contracts/dex/src/lib.rs.
Dependencies
None.
Difficulty level
EASY.
Estimated effort
S (~1 day).
Problem Statement
Several DEX view functions compute utilisation that can divide by zero on a fresh pool.
Why it matters
Reliability.
Technical Context
Add a guarded divide with explicit
ZeroLiquidityerrors.Expected Outcome
Zero liquidity returns clean error rather than aborting.
Acceptance Criteria
ZeroLiquidityerror defined.Implementation Notes
Add
is_zerochecks.Files or modules likely to be affected
contracts/dex/src/lib.rs.Dependencies
None.
Difficulty level
EASY.
Estimated effort
S (~1 day).