Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new solver for Bitget, including configuration, API client, and tests. The implementation is well-structured and follows existing patterns in the codebase. The test coverage is good, including happy path, error cases, and edge cases like out-of-price swaps. I have identified one high-severity finding regarding the mapping of API error codes, which appears to be incorrect and could lead to miscategorization of errors from the Bitget API. This comment has been retained as it does not conflict with any existing rules.
How did you get only 1 solver to participate in auction on base staging? |
Exactly |
jmg-duarte
left a comment
There was a problem hiding this comment.
Some questions but not worth blocking the PR for
| ))) | ||
| } | ||
| cli::Command::Bitget { config: path } => { | ||
| let config = config::dex::bitget::file::load(&path).await; |
There was a problem hiding this comment.
Nit: Given you're using expect right after, IMO load could return the result instead
| #[serde_as(as = "serde_with::DisplayFromStr")] | ||
| endpoint: reqwest::Url, |
There was a problem hiding this comment.
Isn't this available with the serde feature?
| pub fn decode_calldata(&self) -> Result<Vec<u8>, hex::FromHexError> { | ||
| let hex_str = self.data.strip_prefix("0x").unwrap_or(&self.data); | ||
| hex::decode(hex_str) | ||
| } |
There was a problem hiding this comment.
Why not use the const_hex, which handles this by default?
There was a problem hiding this comment.
It will be addressed in a follow-up PR.


This effectively replicates gnosis/solvers#203
Summary
The Bitget API uses a two-step POST flow:The BitGet team suggested using thequote(to get the optimal routing market and output amount) followed byswap(to get the on-chain calldata)request_mod="rich"param in the/swapAPI, which makes the response contain much more data, including theoutAmount.To mitigate the race condition betweenNot needed anymore because of the previous pointquoteandswapcalls, slippage is applied to the quoted output and passed astoMinAmountto the swap endpoint, ensuring consistency between what the calldata enforces on-chain and what the solver reportsexactOutmodeChanges
config/example.bitget.toml- Example configurationHow to test
New unit and manual e2e tests (ignored by default).