fix: Use abi_encode_packed in ple_encode()
--- don't change below this line --- ENG-4081 Took 17 minutes
This commit is contained in:
@@ -265,7 +265,7 @@ mod tests {
|
|||||||
// "0000000000000000000000000000000000000000000000000000000000000000", // nonce
|
// "0000000000000000000000000000000000000000000000000000000000000000", // nonce
|
||||||
// "0000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // spender
|
// "0000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // spender
|
||||||
// "00000000000000000000000000000000000000000000000000000000679a8006", // deadline
|
// "00000000000000000000000000000000000000000000000000000000679a8006", // deadline
|
||||||
// offsets???
|
// offsets
|
||||||
// "0000000000000000000000000000000000000000000000000000000000000200",
|
// "0000000000000000000000000000000000000000000000000000000000000200",
|
||||||
// "0000000000000000000000000000000000000000000000000000000000000280",
|
// "0000000000000000000000000000000000000000000000000000000000000280",
|
||||||
// "0000000000000000000000000000000000000000000000000000000000000041",
|
// "0000000000000000000000000000000000000000000000000000000000000041",
|
||||||
@@ -273,15 +273,9 @@ mod tests {
|
|||||||
// "fc5bac4e27cd5d71c85d232d8c6b31ea924d2e0031091ff9a39579d9e49c214328ea34876961d9200af691373c71a174e166793d02241c76adb93c5f87fe0f381c",
|
// "fc5bac4e27cd5d71c85d232d8c6b31ea924d2e0031091ff9a39579d9e49c214328ea34876961d9200af691373c71a174e166793d02241c76adb93c5f87fe0f381c",
|
||||||
|
|
||||||
let expected_swaps = String::from(concat!(
|
let expected_swaps = String::from(concat!(
|
||||||
// ple encode adds aaalll of this :/ is it correct?
|
// ple encoded swaps
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000120000",
|
"000000000000000000000000000000000000000000000000000000000005d005b",
|
||||||
"0000000000000000000000000000000000000000000000000000000000020000",
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000060000",
|
|
||||||
"000000000000000000000000000000000000000000000000000000000005b000",
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000080000",
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"000000000000000000000000000000000000000000000000000000000005b",
|
|
||||||
// Swap header
|
// Swap header
|
||||||
"01", // token in index
|
"01", // token in index
|
||||||
"00", // token out index
|
"00", // token out index
|
||||||
@@ -294,7 +288,7 @@ mod tests {
|
|||||||
"2c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // receiver
|
"2c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // receiver
|
||||||
"00", // zero2one
|
"00", // zero2one
|
||||||
"00", // exact out
|
"00", // exact out
|
||||||
"0000000000", // padding
|
"000000", // padding
|
||||||
));
|
));
|
||||||
let hex_calldata = encode(&calldata);
|
let hex_calldata = encode(&calldata);
|
||||||
assert_eq!(hex_calldata[..520], expected_input);
|
assert_eq!(hex_calldata[..520], expected_input);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub fn ple_encode(action_data_array: Vec<Vec<u8>>) -> Vec<u8> {
|
|||||||
|
|
||||||
for action_data in action_data_array {
|
for action_data in action_data_array {
|
||||||
let args = (encoded_action_data, action_data.len() as u16, action_data);
|
let args = (encoded_action_data, action_data.len() as u16, action_data);
|
||||||
encoded_action_data = args.abi_encode();
|
encoded_action_data = args.abi_encode_packed();
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_action_data
|
encoded_action_data
|
||||||
|
|||||||
Reference in New Issue
Block a user