refactor: (Solution) replace check_amount with checked_amount

- This is to have consistency with checked_token
This commit is contained in:
TAMARA LIPOWSKI
2025-02-11 11:25:58 -05:00
parent c4c282a62e
commit 1c565deb57
6 changed files with 15 additions and 15 deletions

View File

@@ -279,7 +279,7 @@ impl StrategyEncoder for SplitSwapStrategyEncoder {
&solution.given_amount,
)?;
let mut min_amount_out = solution
.check_amount
.checked_amount
.unwrap_or(BigUint::ZERO);
if let (Some(expected_amount), Some(slippage)) =
@@ -534,7 +534,7 @@ mod tests {
given_amount: BigUint::from(1000000000000000000u64),
expected_amount: Some(BigUint::from(1000000000000000000u64)),
checked_token: token_out,
check_amount: None,
checked_amount: None,
sender: Bytes::from_str("0x0000000000000000000000000000000000000000").unwrap(),
// The receiver was generated with `makeAddr("bob") using forge`
receiver: Bytes::from_str("0x1d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e").unwrap(),
@@ -596,7 +596,7 @@ mod tests {
fn test_split_swap_strategy_encoder_simple_route(
#[case] expected_amount: Option<BigUint>,
#[case] slippage: Option<f64>,
#[case] check_amount: Option<BigUint>,
#[case] checked_amount: Option<BigUint>,
#[case] expected_min_amount: U256,
) {
// Performs a single swap from WETH to DAI on a USV2 pool
@@ -628,7 +628,7 @@ mod tests {
checked_token: dai,
expected_amount,
slippage,
check_amount,
checked_amount,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
@@ -728,7 +728,7 @@ mod tests {
given_amount: BigUint::from_str("1_000000000000000000").unwrap(),
checked_token: dai,
expected_amount: Some(BigUint::from_str("3_000_000000000000000000").unwrap()),
check_amount: None,
checked_amount: None,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
@@ -776,7 +776,7 @@ mod tests {
given_amount: BigUint::from_str("3_000_000000000000000000").unwrap(),
checked_token: eth(),
expected_amount: Some(BigUint::from_str("1_000000000000000000").unwrap()),
check_amount: None,
checked_amount: None,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),
@@ -865,7 +865,7 @@ mod tests {
given_amount: BigUint::from_str("1_000000000000000000").unwrap(),
checked_token: usdc,
expected_amount: Some(BigUint::from_str("3_000_000000").unwrap()),
check_amount: None,
checked_amount: None,
sender: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
receiver: Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").unwrap(),
router_address: Bytes::from_str("0x3Ede3eCa2a72B3aeCC820E955B36f38437D01395").unwrap(),

View File

@@ -269,7 +269,7 @@ mod tests {
exact_out: false,
given_token: eth(),
checked_token: dai(),
check_amount: None,
checked_amount: None,
swaps: vec![swap],
native_action: Some(NativeAction::Wrap),
..Default::default()
@@ -383,7 +383,7 @@ mod tests {
let solution = Solution {
exact_out: false,
checked_token: eth(),
check_amount: None,
checked_amount: None,
swaps: vec![swap],
native_action: Some(NativeAction::Unwrap),
..Default::default()

View File

@@ -38,7 +38,7 @@ pub struct Solution {
/// Minimum amount to be checked for the solution to be valid.
/// If not set, the check will not be performed.
#[serde(with = "biguint_string_option")]
pub check_amount: Option<BigUint>,
pub checked_amount: Option<BigUint>,
/// List of swaps to fulfill the solution.
pub swaps: Vec<Swap>,
/// Address of the router contract to be used for the swaps.