From 94665378d9b4b087964bdf681c1e138b8af7841b Mon Sep 17 00:00:00 2001 From: Prathamesh Raut Date: Tue, 12 Mar 2024 23:25:09 +0530 Subject: [PATCH] Fixed rustfmt --- src/behaviors/deployer.rs | 38 ++++++++++++++++++++---------------- src/behaviors/pool_admin.rs | 4 +--- src/behaviors/token_admin.rs | 6 +++--- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/behaviors/deployer.rs b/src/behaviors/deployer.rs index 8e2adaa..41b8bb5 100644 --- a/src/behaviors/deployer.rs +++ b/src/behaviors/deployer.rs @@ -12,7 +12,6 @@ use ethers::types::{H160, U256}; use tracing::info; use self::token_admin::TokenData; - use super::*; use crate::bindings::uniswap_v3_factory::UniswapV3Factory; @@ -40,7 +39,7 @@ pub struct LiquidExchangeParameters { #[derive(Debug, Deserialize, Serialize)] pub struct Deployer { - pub liquid_exchange_parameters: LiquidExchangeParameters + pub liquid_exchange_parameters: LiquidExchangeParameters, } #[async_trait::async_trait] @@ -54,23 +53,28 @@ impl Behavior<()> for Deployer { let le_param = self.liquid_exchange_parameters.clone(); let liquid_exchange = deploy_liquid_exchange( - &client, - &le_param.asset_token_parameters, + &client, + &le_param.asset_token_parameters, &le_param.quote_token_parameters, - le_param.initial_price - ).await?; + le_param.initial_price, + ) + .await?; info!("Factory deployed at {:?}", factory.address()); - info!("Liquid exchange deployed at {:?}", liquid_exchange.address()); - info!("Liquid exchange initial price : {:?}", liquid_exchange.price().call().await?); + info!( + "Liquid exchange deployed at {:?}", + liquid_exchange.address() + ); + info!( + "Liquid exchange initial price : {:?}", + liquid_exchange.price().call().await? + ); let deployment_data = DeploymentData { factory: factory.address(), liquid_exchange: liquid_exchange.address(), }; - messager - .send(To::All, &deployment_data) - .await?; + messager.send(To::All, &deployment_data).await?; Ok(None) } @@ -90,7 +94,7 @@ pub async fn deploy_liquid_exchange( client: &Arc, arbx_param: &TokenData, arby_param: &TokenData, - initial_price: f64 + initial_price: f64, ) -> Result> { let initial_liquid_exchange_price = U256::from((initial_price * 10f64.powf(18.0)) as u64); @@ -121,15 +125,15 @@ pub async fn deploy_liquid_exchange( info!("Arbiter Token Y contract deployed at {:?}", arby.address()); LiquidExchange::deploy( - client.clone(), + client.clone(), ( arbx.address(), arby.address(), initial_liquid_exchange_price, ), ) - .map_err(|e| anyhow!("Failed to deploy liquid exchange: {}", e))? - .send() - .await - .map_err(|e| anyhow!("Failed to send liquid exchange: {}", e)) + .map_err(|e| anyhow!("Failed to deploy liquid exchange: {}", e))? + .send() + .await + .map_err(|e| anyhow!("Failed to send liquid exchange: {}", e)) } diff --git a/src/behaviors/pool_admin.rs b/src/behaviors/pool_admin.rs index eedb25a..2aaf535 100644 --- a/src/behaviors/pool_admin.rs +++ b/src/behaviors/pool_admin.rs @@ -128,9 +128,7 @@ mod tests { fee: 100, }; - messager - .send(To::All, &pool_creation_request) - .await?; + messager.send(To::All, &pool_creation_request).await?; Ok(None) } diff --git a/src/behaviors/token_admin.rs b/src/behaviors/token_admin.rs index 15a5ba5..846af84 100644 --- a/src/behaviors/token_admin.rs +++ b/src/behaviors/token_admin.rs @@ -155,9 +155,9 @@ impl Behavior for TokenAdmin { .await?; self.token_data.insert(req.name.clone(), req.clone()); - self.tokens.as_mut().and_then(|token_obj| - token_obj.insert(req.name, token) - ); + self.tokens + .as_mut() + .and_then(|token_obj| token_obj.insert(req.name, token)); Ok(ControlFlow::Continue) }