diff --git a/contracts/liquidity/factory/src/query.rs b/contracts/liquidity/factory/src/query.rs index 49b50a86..c8e62980 100644 --- a/contracts/liquidity/factory/src/query.rs +++ b/contracts/liquidity/factory/src/query.rs @@ -83,7 +83,7 @@ pub fn query_all_pools(deps: Deps) -> Result { let pools = PAIR_TO_VLP .range(deps.storage, None, None, cosmwasm_std::Order::Ascending) .flat_map(|item| -> Result<_, ContractError> { - let item = item.unwrap(); + let item = item?; Ok(PoolVlpResponse { pair: Pair::new(item.0 .0, item.0 .1)?, vlp: item.1, diff --git a/packages/euclid/src/utils/fund_manager.rs b/packages/euclid/src/utils/fund_manager.rs index 946b74de..de61819a 100644 --- a/packages/euclid/src/utils/fund_manager.rs +++ b/packages/euclid/src/utils/fund_manager.rs @@ -43,7 +43,10 @@ impl FundManager { self.get(denom).ge(&amount), ContractError::InsufficientFunds {} ); - *self.funds.get_mut(denom).unwrap() -= amount; + *self + .funds + .get_mut(denom) + .ok_or(ContractError::new("Denom not found"))? -= amount; Ok(()) }