fix: Use abi_encode_packed in ple_encode()

--- don't change below this line ---
ENG-4081 Took 17 minutes
This commit is contained in:
Diana Carvalho
2025-01-30 15:39:07 +00:00
parent 6e8d2ede59
commit 82e671df39
2 changed files with 5 additions and 11 deletions

View File

@@ -265,7 +265,7 @@ mod tests {
// "0000000000000000000000000000000000000000000000000000000000000000", // nonce
// "0000000000000000000000002c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // spender
// "00000000000000000000000000000000000000000000000000000000679a8006", // deadline
// offsets???
// offsets
// "0000000000000000000000000000000000000000000000000000000000000200",
// "0000000000000000000000000000000000000000000000000000000000000280",
// "0000000000000000000000000000000000000000000000000000000000000041",
@@ -273,15 +273,9 @@ mod tests {
// "fc5bac4e27cd5d71c85d232d8c6b31ea924d2e0031091ff9a39579d9e49c214328ea34876961d9200af691373c71a174e166793d02241c76adb93c5f87fe0f381c",
let expected_swaps = String::from(concat!(
// ple encode adds aaalll of this :/ is it correct?
// ple encoded swaps
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000120000",
"0000000000000000000000000000000000000000000000000000000000020000",
"0000000000000000000000000000000000000000000000000000000000060000",
"000000000000000000000000000000000000000000000000000000000005b000",
"0000000000000000000000000000000000000000000000000000000000080000",
"0000000000000000000000000000000000000000000000000000000000000000",
"000000000000000000000000000000000000000000000000000000000005b",
"000000000000000000000000000000000000000000000000000000000005d005b",
// Swap header
"01", // token in index
"00", // token out index
@@ -294,7 +288,7 @@ mod tests {
"2c6a3cd97c6283b95ac8c5a4459ebb0d5fd404f4", // receiver
"00", // zero2one
"00", // exact out
"0000000000", // padding
"000000", // padding
));
let hex_calldata = encode(&calldata);
assert_eq!(hex_calldata[..520], expected_input);