Skip to content

Commit

Permalink
throw correct error when pair address is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKuczma committed Sep 25, 2024
1 parent f2e9ea8 commit 58583b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions amm/contracts/router_v2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ pub mod router_v2 {
Some(pool_id) => pool_id,
None => self.pair_factory_ref().create_pair(token_0, token_1)?,
};
match self.get_pool(pool_id) {
Ok(Pool::Pair(pair)) => Ok(pair),
_ => Err(RouterV2Error::PairNotFound),
match self.get_pool(pool_id)? {
Pool::Pair(pair) => Ok(pair),
Pool::StablePool(_) => Err(RouterV2Error::PairNotFound),
}
}

Expand Down

0 comments on commit 58583b8

Please sign in to comment.