Skip to content

Commit

Permalink
feat: deployer behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ts0yu committed Feb 16, 2024
1 parent 88ae74a commit 6ab0833
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 454 deletions.
28 changes: 28 additions & 0 deletions src/behaviors/deployer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::sync::Arc;

use anyhow::Result;
use arbiter_core::{middleware::ArbiterMiddleware};
use arbiter_engine::{
machine::{Behavior, EventStream},
messager::Messager,
};

use super::*;

use crate::bindings::uniswap_v3_factory::UniswapV3Factory;

#[derive(Debug, Deserialize, Serialize)]
pub struct Deployer;

#[async_trait::async_trait]
impl Behavior<()> for Deployer {
async fn startup(
&mut self,
client: Arc<ArbiterMiddleware>,
_messager: Messager,
) -> Result<Option<EventStream<()>>> {
UniswapV3Factory::deploy(client, ()).unwrap().send().await.unwrap();

Ok(None)
}
}
6 changes: 6 additions & 0 deletions src/behaviors/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use arbiter_macros::Behaviors;
use serde::{Deserialize, Serialize};

pub mod deployer;

pub use deployer::Deployer;
452 changes: 0 additions & 452 deletions src/bindings/mock_time_uniswap_v3_pool_deployer.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub mod ierc20_minimal;
pub mod liquidity_math;
pub mod low_gas_safe_math;
pub mod mock_time_uniswap_v3_pool;
pub mod mock_time_uniswap_v3_pool_deployer;
pub mod no_delegate_call;
pub mod oracle;
pub mod position;
Expand Down
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
fn main() {}
use arbiter_engine::{agent::Agent, world::World};

pub mod behaviors;
pub mod bindings;

use crate::behaviors::Deployer;

#[tokio::main]
async fn main() {
let mut world = World::new("univ3");

let deployer = Agent::builder("deployer").with_behavior(Deployer);

world.add_agent(deployer);
world.run().await;
}

0 comments on commit 6ab0833

Please sign in to comment.