fix: cargo and forge fmt
This commit is contained in:
@@ -384,12 +384,13 @@ contract BebopExecutor is IExecutor, IExecutorErrors, RestrictTransferFrom {
|
|||||||
assembly {
|
assembly {
|
||||||
let src := add(signatureData, add(0x20, offset))
|
let src := add(signatureData, add(0x20, offset))
|
||||||
let dst := add(sigBytes, 0x20)
|
let dst := add(sigBytes, 0x20)
|
||||||
|
|
||||||
// Copy sigLength bytes from src to dst
|
// Copy sigLength bytes from src to dst
|
||||||
let end := add(dst, sigLength)
|
let end := add(dst, sigLength)
|
||||||
for { } lt(dst, end) { dst := add(dst, 0x20) src := add(src, 0x20) } {
|
for {} lt(dst, end) {
|
||||||
mstore(dst, mload(src))
|
dst := add(dst, 0x20)
|
||||||
}
|
src := add(src, 0x20)
|
||||||
|
} { mstore(dst, mload(src)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
signatures[i] = IBebopSettlement.MakerSignature({
|
signatures[i] = IBebopSettlement.MakerSignature({
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ impl SwapEncoder for BebopSwapEncoder {
|
|||||||
let token_to_approve = token_in.clone();
|
let token_to_approve = token_in.clone();
|
||||||
let settlement_address = Address::from_str(&self.settlement_address)
|
let settlement_address = Address::from_str(&self.settlement_address)
|
||||||
.map_err(|_| EncodingError::FatalError("Invalid settlement address".to_string()))?;
|
.map_err(|_| EncodingError::FatalError("Invalid settlement address".to_string()))?;
|
||||||
|
|
||||||
approval_needed = token_approvals_manager.approval_needed(
|
approval_needed = token_approvals_manager.approval_needed(
|
||||||
token_to_approve,
|
token_to_approve,
|
||||||
tycho_router_address,
|
tycho_router_address,
|
||||||
@@ -640,7 +640,6 @@ impl SwapEncoder for BebopSwapEncoder {
|
|||||||
approval_needed = true;
|
approval_needed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Validate component ID
|
// Validate component ID
|
||||||
Self::validate_component_id(&swap.component.id)?;
|
Self::validate_component_id(&swap.component.id)?;
|
||||||
|
|
||||||
@@ -660,7 +659,8 @@ impl SwapEncoder for BebopSwapEncoder {
|
|||||||
|
|
||||||
// Encode packed data for the executor
|
// Encode packed data for the executor
|
||||||
// Format: token_in | token_out | transfer_type | order_type |
|
// 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 = (
|
let args = (
|
||||||
token_in,
|
token_in,
|
||||||
token_out,
|
token_out,
|
||||||
@@ -1674,7 +1674,8 @@ mod tests {
|
|||||||
let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
|
let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
|
||||||
static_attributes
|
static_attributes
|
||||||
.insert("quote_data".into(), Bytes::from(hex::decode("1234567890abcdef").unwrap()));
|
.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 {
|
let bebop_component = ProtocolComponent {
|
||||||
id: String::from("bebop"),
|
id: String::from("bebop"),
|
||||||
@@ -1744,7 +1745,7 @@ mod tests {
|
|||||||
|
|
||||||
write_calldata_to_file("test_encode_bebop_single", hex_swap.as_str());
|
write_calldata_to_file("test_encode_bebop_single", hex_swap.as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_encode_bebop_multi() {
|
fn test_encode_bebop_multi() {
|
||||||
use alloy::hex;
|
use alloy::hex;
|
||||||
@@ -1753,7 +1754,8 @@ mod tests {
|
|||||||
let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
|
let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
|
||||||
static_attributes
|
static_attributes
|
||||||
.insert("quote_data".into(), Bytes::from(hex::decode("abcdef1234567890").unwrap()));
|
.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
|
static_attributes.insert("order_type".into(), Bytes::from(vec![1u8])); // Multi order
|
||||||
|
|
||||||
let bebop_component = ProtocolComponent {
|
let bebop_component = ProtocolComponent {
|
||||||
@@ -1824,7 +1826,7 @@ mod tests {
|
|||||||
|
|
||||||
write_calldata_to_file("test_encode_bebop_multi", hex_swap.as_str());
|
write_calldata_to_file("test_encode_bebop_multi", hex_swap.as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_encode_bebop_aggregate() {
|
fn test_encode_bebop_aggregate() {
|
||||||
use alloy::hex;
|
use alloy::hex;
|
||||||
@@ -1834,7 +1836,10 @@ mod tests {
|
|||||||
static_attributes
|
static_attributes
|
||||||
.insert("quote_data".into(), Bytes::from(hex::decode("deadbeef").unwrap()));
|
.insert("quote_data".into(), Bytes::from(hex::decode("deadbeef").unwrap()));
|
||||||
// For aggregate, signature contains multiple signatures encoded
|
// 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
|
static_attributes.insert("order_type".into(), Bytes::from(vec![2u8])); // Aggregate order
|
||||||
|
|
||||||
let bebop_component = ProtocolComponent {
|
let bebop_component = ProtocolComponent {
|
||||||
|
|||||||
Reference in New Issue
Block a user