Map OKX error code 51005 (honeypot token) to NotFound#4293
Conversation
Undocumented OKX error code for tokens flagged as honeypots or leveraged tokens. These can't be traded and should be treated the same as unsupported tokens rather than logging at warn level.
There was a problem hiding this comment.
Code Review
This pull request adds a new error code 51005 to the handle_api_error function in crates/solvers/src/infra/dex/okx/mod.rs, mapping it to Error::NotFound for undocumented honeypot or leveraged token issues. I have no feedback to provide on the current changes.
jmg-duarte
left a comment
There was a problem hiding this comment.
LGTM
FYI: this seems documented in a different OKX offering API https://tr.okx.com/docs-v5/en/#error-code-rest-api-public (you'll need to search for the code). Super weird...
It looks like a different API. The error code is about the order amount, which is irrelevant to the response we receive. |
Description
Map undocumented OKX error code 51005 to
NotFoundinstead of the genericApierror.OKX returns this code for tokens flagged as honeypots or leveraged tokens (e.g. "0x.. cannot be traded as it may be a honeypot or leveraged token"). This is functionally identical to 82104 (token not supported) - the token simply can't be traded. Previously, it fell through to
Error::Apiand produced unnecessary warn-level logs. We've encountered false-positive alerts for the Tornado.Cash token, which doesn't seem to be a honeypot at all.Code 51005 is not in the OKX error code docs.
How to test
Existing tests