From 7a59d8f61e854fe2e59b62b33bc6ca48d5d5db67 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Fri, 1 Dec 2023 11:29:23 +0700 Subject: [PATCH] linting --- src/contract.rs | 10 +++++----- src/msg.rs | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/contract.rs b/src/contract.rs index 459b756..6ff1ac9 100644 --- a/src/contract.rs +++ b/src/contract.rs @@ -116,16 +116,16 @@ pub mod execute { let offer_asset = coin.denom.clone(); let amount: u128 = if offer_asset != pair_info.0 && offer_asset != pair_info.1 { return Err(ContractError::Payment( - cw_utils::PaymentError::MissingDenom(coin.denom.to_string()), + cw_utils::PaymentError::MissingDenom(coin.denom), )); } else { coin.amount.into() }; let asked_asset = if pair_info.0 == offer_asset { - pair_info.1.clone() + pair_info.1 } else { - pair_info.0.clone() + pair_info.0 }; let swap_astro_msg = pair::ExecuteMsg::Swap { @@ -181,7 +181,7 @@ pub mod execute { }; let amount: u128 = if !offer.equal(&asset_infos[0]) && !offer.equal(&asset_infos[1]) { return Err(ContractError::Payment( - cw_utils::PaymentError::MissingDenom(coin.denom.to_string()), + cw_utils::PaymentError::MissingDenom(coin.denom), )); } else { coin.amount.into() @@ -212,7 +212,7 @@ pub mod execute { to: Some(info.sender.to_string()), }; let exec_cw20_mint_msg = WasmMsg::Execute { - contract_addr: pool_address.clone().to_string(), + contract_addr: pool_address.to_string(), msg: to_json_binary(&swap_astro_msg)?, funds: coins(amount - fee, &offer_asset), }; diff --git a/src/msg.rs b/src/msg.rs index 0865f6c..18648d7 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -3,6 +3,7 @@ use cosmwasm_std::Addr; #[cw_serde] pub struct InstantiateMsg { + // Fee for each swap, max 10000 equals 100% pub fee_rate: u64, }