Skip to content

Commit

Permalink
fix: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrizsabin committed Nov 19, 2024
1 parent 88404a1 commit 4717325
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions contracts/cosmwasm-vm/cw-intents-v1/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ impl<'a> CwIntentV1Service<'a> {
if self.is_order_finished(deps.storage, &order_hash) {
return Err(ContractError::OrderAlreadyComplete);
}
self.set_order_finished(deps.storage, &keccak256(&order.rlp_bytes()), true).unwrap();
self.set_order_finished(deps.storage, &keccak256(&order.rlp_bytes()), true)
.unwrap();
let mut response = self.receive_payment(
deps.as_ref(),
env.clone(),
Expand Down Expand Up @@ -120,7 +121,7 @@ impl<'a> CwIntentV1Service<'a> {
response = response.add_message(fee_transfer);
}
response = response.add_event(order_fill_event);

Ok(response)
}

Expand Down
17 changes: 9 additions & 8 deletions contracts/cosmwasm-vm/cw-intents-v1/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,18 @@ mod tests {

#[test]
fn test_order_cancel_encoding() {
let cancel= OrderCancel{
let cancel = OrderCancel {
order_bytes: hex::decode("6c449988e2f33302803c93f8287dc1d8cb33848a").unwrap(),
};
assert!(cancel.rlp_bytes()==hex::decode("d5946c449988e2f33302803c93f8287dc1d8cb33848a").unwrap());
assert!(
cancel.rlp_bytes()
== hex::decode("d5946c449988e2f33302803c93f8287dc1d8cb33848a").unwrap()
);
}

#[test]
fn test_swap_order_encoding(){
let order =SwapOrder {
fn test_swap_order_encoding() {
let order = SwapOrder {
id: 1,
emitter: "0xbe6452d4d6c61cee97d3".to_string(),
src_nid: "Ethereum".to_string(),
Expand All @@ -255,7 +258,7 @@ mod tests {
};
assert!(order.rlp_bytes()==hex::decode("f8a601963078626536343532643464366336316365653937643388457468657265756d87506f6c79676f6e983078336533366564646436356532333932323265376536379c30786432633632313862383735343537613431623666623739363465a43078313433353533343065383537393132313838623766323032643535303232323438378203e89a307839316134373238623531373438346630663631306465376282038480").unwrap());

let order =SwapOrder {
let order = SwapOrder {
id: 1,
emitter: "0xbe6452d4d6c61cee97d3".to_string(),
src_nid: "Ethereum".to_string(),
Expand All @@ -265,11 +268,9 @@ mod tests {
token: "0x14355340e857912188b7f202d550222487".to_string(),
amount: 100000 * 10000000000000000000000,
to_token: "0x91a4728b517484f0f610de7b".to_string(),
to_amount: 900*10000000,
to_amount: 900 * 10000000,
data: hex::decode("6c449988e2f33302803c93f8287dc1d8cb33848a").unwrap(),
};
assert!(order.rlp_bytes()==hex::decode("f8c701963078626536343532643464366336316365653937643388457468657265756d87506f6c79676f6e983078336533366564646436356532333932323265376536379c30786432633632313862383735343537613431623666623739363465a43078313433353533343065383537393132313838623766323032643535303232323438378c033b2e3c9fd0803ce80000009a3078393161343732386235313734383466306636313064653762850218711a00946c449988e2f33302803c93f8287dc1d8cb33848a").unwrap());


}
}

0 comments on commit 4717325

Please sign in to comment.