cargo fmt & clippy
This commit is contained in:
@@ -286,14 +286,18 @@ impl SwapEncoder for EkuboSwapEncoder {
|
|||||||
return Err(EncodingError::InvalidInput("exact out swaps not implemented".to_string()));
|
return Err(EncodingError::InvalidInput("exact out swaps not implemented".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let fee = u64::from_be_bytes(get_static_attribute(&swap, "fee")?
|
let fee = u64::from_be_bytes(
|
||||||
.try_into()
|
get_static_attribute(&swap, "fee")?
|
||||||
.map_err(|_| EncodingError::FatalError("fee should be an u64".to_string()))?
|
.try_into()
|
||||||
|
.map_err(|_| EncodingError::FatalError("fee should be an u64".to_string()))?,
|
||||||
);
|
);
|
||||||
|
|
||||||
let tick_spacing = u32::from_be_bytes(get_static_attribute(&swap, "tick_spacing")?
|
let tick_spacing = u32::from_be_bytes(
|
||||||
.try_into()
|
get_static_attribute(&swap, "tick_spacing")?
|
||||||
.map_err(|_| EncodingError::FatalError("tick_spacing should be an u32".to_string()))?
|
.try_into()
|
||||||
|
.map_err(|_| {
|
||||||
|
EncodingError::FatalError("tick_spacing should be an u32".to_string())
|
||||||
|
})?,
|
||||||
);
|
);
|
||||||
|
|
||||||
let extension: Address = get_static_attribute(&swap, "extension")?
|
let extension: Address = get_static_attribute(&swap, "extension")?
|
||||||
@@ -713,13 +717,13 @@ mod tests {
|
|||||||
let static_attributes = HashMap::from([
|
let static_attributes = HashMap::from([
|
||||||
("fee".to_string(), Bytes::from(0_u64)),
|
("fee".to_string(), Bytes::from(0_u64)),
|
||||||
("tick_spacing".to_string(), Bytes::from(0_u32)),
|
("tick_spacing".to_string(), Bytes::from(0_u32)),
|
||||||
("extension".to_string(), Bytes::from("0x51d02a5948496a67827242eabc5725531342527c")), // Oracle
|
(
|
||||||
|
"extension".to_string(),
|
||||||
|
Bytes::from("0x51d02a5948496a67827242eabc5725531342527c"),
|
||||||
|
), // Oracle
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let component = ProtocolComponent {
|
let component = ProtocolComponent { static_attributes, ..Default::default() };
|
||||||
static_attributes,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let swap = Swap {
|
let swap = Swap {
|
||||||
component,
|
component,
|
||||||
@@ -780,7 +784,10 @@ mod tests {
|
|||||||
static_attributes: HashMap::from([
|
static_attributes: HashMap::from([
|
||||||
("fee".to_string(), Bytes::from(0_u64)),
|
("fee".to_string(), Bytes::from(0_u64)),
|
||||||
("tick_spacing".to_string(), Bytes::from(0_u32)),
|
("tick_spacing".to_string(), Bytes::from(0_u32)),
|
||||||
("extension".to_string(), Bytes::from("0x51d02a5948496a67827242eabc5725531342527c")), // Oracle
|
(
|
||||||
|
"extension".to_string(),
|
||||||
|
Bytes::from("0x51d02a5948496a67827242eabc5725531342527c"),
|
||||||
|
), // Oracle
|
||||||
]),
|
]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
@@ -812,7 +819,8 @@ mod tests {
|
|||||||
.encode_swap(second_swap, encoding_context)
|
.encode_swap(second_swap, encoding_context)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let combined_hex = format!("{}{}", encode(first_encoded_swap), encode(second_encoded_swap));
|
let combined_hex =
|
||||||
|
format!("{}{}", encode(first_encoded_swap), encode(second_encoded_swap));
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
combined_hex,
|
combined_hex,
|
||||||
@@ -833,5 +841,4 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user