diff --git a/src/behaviors/deployer.rs b/src/behaviors/deployer.rs index 0d8faa5..84150c2 100644 --- a/src/behaviors/deployer.rs +++ b/src/behaviors/deployer.rs @@ -11,7 +11,7 @@ use ethers::types::H160; use super::*; use crate::bindings::{token::ArbiterToken, uniswap_v3_factory::UniswapV3Factory}; -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] pub struct DeploymentData { token_0: H160, token_1: H160, @@ -30,7 +30,7 @@ impl DeploymentData { } } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] pub struct Deployer; #[async_trait::async_trait] @@ -54,7 +54,7 @@ impl Behavior<()> for Deployer { .send() .await?; - let factory = UniswapV3Factory::deploy(client, ())?.send().await?; + let factory = UniswapV3Factory::deploy(client.clone(), ())?.send().await?; let pool = factory .create_pool(token_0.address(), token_1.address(), 100) @@ -69,7 +69,16 @@ impl Behavior<()> for Deployer { pool, ); - messager.send(To::All, serde_json::to_string(&deployment_data)?).await; + match serde_json::to_string(&deployment_data) { + Ok(json_string) => { + messager + .send(To::All, json_string) + .await?; + } + Err(_) => { + return Err(anyhow::anyhow!("Failed to serialize deployment data")); + } + } Ok(None) } diff --git a/src/behaviors/mod.rs b/src/behaviors/mod.rs index e6dbeac..38b8105 100644 --- a/src/behaviors/mod.rs +++ b/src/behaviors/mod.rs @@ -2,4 +2,4 @@ use serde::{Deserialize, Serialize}; pub mod deployer; -pub use deployer::Deployer; \ No newline at end of file +pub use deployer::Deployer; diff --git a/src/main.rs b/src/main.rs index 0ab4d9a..0d778d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,5 +12,5 @@ async fn main() { let deployer = Agent::builder("deployer").with_behavior(Deployer); world.add_agent(deployer); - world.run().await; + let _ = world.run().await; }