Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc committed Apr 17, 2024
1 parent c087d4b commit ffd9b11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/core/component/dex/src/state_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ pub(crate) mod engine {
pub(crate) fn key(from: &asset::Id, a_from_b: Amount) -> [u8; 55] {
let mut key = [0u8; 55];
key[0..7].copy_from_slice(b"dex/ra/");
key[7..39].copy_from_slice(&from.to_bytes());
key[39..55].copy_from_slice(&a_from_b.to_be_bytes());
key[7..32 + 7].copy_from_slice(&from.to_bytes());
// Use the complement of the amount to ensure that the keys are ordered in descending order.
key[32 + 7..32 + 7 + 16].copy_from_slice(&(!a_from_b).to_be_bytes());
key
}

Expand Down

0 comments on commit ffd9b11

Please sign in to comment.