From 17e535494b5f2f211eef889c768f05f00843dc5b Mon Sep 17 00:00:00 2001 From: pedrobergamini <41773103+pedrobergamini@users.noreply.github.com> Date: Wed, 4 Jun 2025 19:57:40 -0300 Subject: [PATCH] fix: cargo and forge fmt --- foundry/src/executors/BebopExecutor.sol | 9 ++++---- .../evm/swap_encoder/swap_encoders.rs | 21 ++++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/foundry/src/executors/BebopExecutor.sol b/foundry/src/executors/BebopExecutor.sol index 266a99d..9a679cc 100644 --- a/foundry/src/executors/BebopExecutor.sol +++ b/foundry/src/executors/BebopExecutor.sol @@ -384,12 +384,13 @@ contract BebopExecutor is IExecutor, IExecutorErrors, RestrictTransferFrom { assembly { let src := add(signatureData, add(0x20, offset)) let dst := add(sigBytes, 0x20) - + // Copy sigLength bytes from src to dst let end := add(dst, sigLength) - for { } lt(dst, end) { dst := add(dst, 0x20) src := add(src, 0x20) } { - mstore(dst, mload(src)) - } + for {} lt(dst, end) { + dst := add(dst, 0x20) + src := add(src, 0x20) + } { mstore(dst, mload(src)) } } signatures[i] = IBebopSettlement.MakerSignature({ diff --git a/src/encoding/evm/swap_encoder/swap_encoders.rs b/src/encoding/evm/swap_encoder/swap_encoders.rs index a3784dd..832f95e 100644 --- a/src/encoding/evm/swap_encoder/swap_encoders.rs +++ b/src/encoding/evm/swap_encoder/swap_encoders.rs @@ -630,7 +630,7 @@ impl SwapEncoder for BebopSwapEncoder { let token_to_approve = token_in.clone(); let settlement_address = Address::from_str(&self.settlement_address) .map_err(|_| EncodingError::FatalError("Invalid settlement address".to_string()))?; - + approval_needed = token_approvals_manager.approval_needed( token_to_approve, tycho_router_address, @@ -640,7 +640,6 @@ impl SwapEncoder for BebopSwapEncoder { approval_needed = true; } - // Validate component ID Self::validate_component_id(&swap.component.id)?; @@ -660,7 +659,8 @@ impl SwapEncoder for BebopSwapEncoder { // Encode packed data for the executor // Format: token_in | token_out | transfer_type | order_type | - // quote_data_length | quote_data | signature_type | signature_length | signature | approval_needed + // quote_data_length | quote_data | signature_type | signature_length | signature | + // approval_needed let args = ( token_in, token_out, @@ -1674,7 +1674,8 @@ mod tests { let mut static_attributes: HashMap = HashMap::new(); static_attributes .insert("quote_data".into(), Bytes::from(hex::decode("1234567890abcdef").unwrap())); - static_attributes.insert("signature".into(), Bytes::from(hex::decode("aabbccdd").unwrap())); + static_attributes + .insert("signature".into(), Bytes::from(hex::decode("aabbccdd").unwrap())); let bebop_component = ProtocolComponent { id: String::from("bebop"), @@ -1744,7 +1745,7 @@ mod tests { write_calldata_to_file("test_encode_bebop_single", hex_swap.as_str()); } - + #[test] fn test_encode_bebop_multi() { use alloy::hex; @@ -1753,7 +1754,8 @@ mod tests { let mut static_attributes: HashMap = HashMap::new(); static_attributes .insert("quote_data".into(), Bytes::from(hex::decode("abcdef1234567890").unwrap())); - static_attributes.insert("signature".into(), Bytes::from(hex::decode("11223344").unwrap())); + static_attributes + .insert("signature".into(), Bytes::from(hex::decode("11223344").unwrap())); static_attributes.insert("order_type".into(), Bytes::from(vec![1u8])); // Multi order let bebop_component = ProtocolComponent { @@ -1824,7 +1826,7 @@ mod tests { write_calldata_to_file("test_encode_bebop_multi", hex_swap.as_str()); } - + #[test] fn test_encode_bebop_aggregate() { use alloy::hex; @@ -1834,7 +1836,10 @@ mod tests { static_attributes .insert("quote_data".into(), Bytes::from(hex::decode("deadbeef").unwrap())); // For aggregate, signature contains multiple signatures encoded - static_attributes.insert("signature".into(), Bytes::from(hex::decode("0000000200000004aabbccdd00000004eeff0011").unwrap())); + static_attributes.insert( + "signature".into(), + Bytes::from(hex::decode("0000000200000004aabbccdd00000004eeff0011").unwrap()), + ); static_attributes.insert("order_type".into(), Bytes::from(vec![2u8])); // Aggregate order let bebop_component = ProtocolComponent {