Bug
`contracts/pool/src/lib.rs` — `deposit(token, amount)` does not distinguish between a zero-amount and a negative-amount call. Both paths hit the same generic error, wasting gas and polluting event logs with no-op deposits.
Impact
- Zero-amount deposits succeed silently or emit misleading events
- Storage entries are created for deposits that transfer no value
- Event log becomes noisy, making off-chain indexers unreliable
Fix
Add an explicit guard at the top of `deposit()`:
```rust
if amount == 0 {
return Err(PoolError::ZeroAmount);
}
if amount < 0 {
return Err(PoolError::NegativeAmount);
}
```
Add `ZeroAmount` and `NegativeAmount` variants to `PoolError`.
Acceptance Criteria
References
- `contracts/pool/src/lib.rs` — `deposit()` function
Bug
`contracts/pool/src/lib.rs` — `deposit(token, amount)` does not distinguish between a zero-amount and a negative-amount call. Both paths hit the same generic error, wasting gas and polluting event logs with no-op deposits.
Impact
Fix
Add an explicit guard at the top of `deposit()`:
```rust
if amount == 0 {
return Err(PoolError::ZeroAmount);
}
if amount < 0 {
return Err(PoolError::NegativeAmount);
}
```
Add `ZeroAmount` and `NegativeAmount` variants to `PoolError`.
Acceptance Criteria
References