Skip to content

Commit

Permalink
feat: arbitrageur init
Browse files Browse the repository at this point in the history
  • Loading branch information
ts0yu authored Aug 28, 2024
1 parent 83843cb commit 0cdb92f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ impl<V> Arena<V> {
.await
.unwrap();

let mut signal = Signal::default();

for (idx, strategy) in self.strategies.iter_mut().enumerate() {
let id = fetcher.toId(self.pool.clone().into()).call().await.unwrap();

Expand All @@ -102,21 +104,24 @@ impl<V> Arena<V> {
.await
.unwrap();

signal = Signal::new(
*pool_manager.address(),
*fetcher.address(),
self.pool.clone(),
self.feed.current_value(),
None,
slot.tick,
slot.sqrtPriceX96,
);

strategy.init(
self.providers[&(idx + 1)].clone(),
Signal::new(
*pool_manager.address(),
*fetcher.address(),
self.pool.clone(),
self.feed.current_value(),
None,
slot.tick,
slot.sqrtPriceX96,
),
signal.clone(),
&mut self.inspector,
);
}

self.arbitrageur.init(&signal, admin_provider.clone()).await;
self.nonce = 6;

for step in 0..config.steps {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ mod types {
}

/// A signal that is passed to a [`Strategy`] to provide information about the current state of the pool.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct Signal {
/// Address of the pool manager.
pub manager: Address,
Expand Down

0 comments on commit 0cdb92f

Please sign in to comment.