-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
666 additions
and
530 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
use super::*; | ||
use arbiter_engine::machine::{State, Configuration, Processing, Behavior, Processor}; | ||
use crate::pool::{PoolType, Pool, PoolConfigurer}; | ||
|
||
// Idea: Let's make a behavior that has two states: | ||
// State 1. This is for configuration and it should have everything be `Serialize`/`Deserialize` so that it can be read in from a config. | ||
// State 2. This is the "built" version of the behavior that may now own client, messager, or contracts (etc.) and other things that had to be gotten from running the `startup` method. | ||
|
||
|
||
// Example: | ||
// Let's make a "pool_creator" type of behavior that will take some configuration for a pool and work to attempt to deploy that pool. | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
pub struct PoolCreator<S: State> { | ||
pub data: S::Data, | ||
} | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
pub struct PoolConfig<P: PoolConfigurer> { | ||
pub params: P::PoolParameters, | ||
pub token_list: Vec<eAddress>, | ||
pub initial_allocation: Vec<eU256>, | ||
} | ||
|
||
pub struct PoolProcessor<P: PoolType> { | ||
pub pool: Pool<P> | ||
} | ||
|
||
|
||
#[async_trait::async_trait] | ||
impl<T> Behavior<()> for PoolCreator<Configuration<PoolConfig<T>>> | ||
where | ||
T: PoolConfigurer, | ||
// P: PoolType, | ||
// E: Send + Sync + 'static, | ||
{ | ||
type Processor = (); | ||
async fn startup(&mut self, client: Arc<ArbiterMiddleware>, messager: Messager) -> Result<Option<(Self::Processor, EventStream<()>)>> { | ||
todo!() | ||
} | ||
} | ||
|
||
// #[async_trait::async_trait] | ||
// impl<P,E> Processor<E> for PoolCreator<Processing<PoolProcessor<P>>> | ||
// where | ||
// P: PoolType, | ||
// E: Send + Sync + 'static, | ||
// { | ||
// async fn process(&mut self, event: E) { | ||
// todo!() | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.