Skip to content

Commit

Permalink
Classify 1Inch invalid token error correctly (#70)
Browse files Browse the repository at this point in the history
We have seen some unactionable 1Inch solver errors over the past few
days. Looking at the logs, this is coming from API responses of the
form:

> { code: 400, description: "not valid token" }

indicating that the 1Inch API cannot handle certain tokens. We already
filter for insufficient liquidity (which also have a 400 code) so it
sees appropriate to label all 400 errors as `NotFound`
  • Loading branch information
fleupold authored Sep 16, 2024
1 parent 60255ed commit 381437e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/infra/dex/oneinch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ impl From<util::http::RoundtripError<dto::Error>> for Error {
// Unfortunately, AFAIK these codes aren't documented anywhere. These
// based on empirical observations of what the API has returned in the
// past.
match err.description.as_str() {
"insufficient liquidity" => Self::NotFound,
match err.status_code {
400 => Self::NotFound,
_ => Self::Api {
code: err.status_code,
description: err.description,
Expand Down

0 comments on commit 381437e

Please sign in to comment.