fix: Use native token curve address and not regular zero address

Took 18 minutes


Took 1 minute
This commit is contained in:
Diana Carvalho
2025-06-27 17:58:29 +01:00
parent 0458b910ab
commit 0f679d6e06

View File

@@ -407,7 +407,10 @@ impl CurveSwapEncoder {
// Some curve pools support both ETH and WETH as tokens.
// They do the wrapping/unwrapping inside the pool
fn normalize_token(&self, token: Address, coins: &[Address]) -> Result<Address, EncodingError> {
let native_token_address = bytes_to_address(&self.native_token_address)?;
let native_token_address =
Address::from_str(&self.native_token_curve_address).map_err(|_| {
EncodingError::FatalError("Invalid native token curve address".to_string())
})?;
let wrapped_native_token_address = bytes_to_address(&self.wrapped_native_token_address)?;
if token == native_token_address && !coins.contains(&token) {
Ok(wrapped_native_token_address)