Skip to content

Commit

Permalink
feat: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ts0yu authored Aug 11, 2024
1 parent ac67b31 commit ec636e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
23 changes: 21 additions & 2 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ use std::collections::HashMap;
use alloy::{providers::ProviderBuilder, signers::local::PrivateKeySigner};

use super::*;
use crate::{config::Config, feed::Feed, strategy::Strategy, types::PoolManager::PoolKey, types::PoolManager};
use crate::{
config::Config,
feed::Feed,
strategy::Strategy,
types::{PoolManager, PoolManager::PoolKey},
};

pub struct Arena {
pub env: AnvilInstance,
Expand All @@ -16,7 +21,21 @@ pub struct Arena {

impl Arena {
pub async fn run(&mut self, config: Config) {
let pool_manager = PoolManager::deploy(self.providers[&0].clone(), U256::from(0)).await;
let admin_provider = self.providers[&0].clone();

let pool_manager = PoolManager::deploy(admin_provider.clone(), U256::from(0))
.await
.unwrap();

pool_manager
.initialize(
self.pool.clone(),
U256::from(79228162514264337593543950336_u128),
Bytes::default(),
)
.call()
.await
.unwrap();

for (idx, strategy) in self.strategies.iter_mut().enumerate() {
strategy.init(self.providers[&(idx + 1)].clone());
Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ pub mod config;
pub mod feed;
pub mod strategy;
pub mod types;
use crate::arena::ArenaBuilder;
use crate::strategy::Strategy;
use crate::types::PoolManager::PoolKey;
use crate::config::Config;
use crate::feed::OrnsteinUhlenbeck;

use alloy::{
network::{Ethereum, EthereumWallet},
node_bindings::{Anvil, AnvilInstance},
primitives::{Address, Bytes, U256},
providers::{
fillers::{ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, WalletFiller},
Identity, RootProvider,
},
transports::http::{Client, Http},
primitives::{U256, Address},
};

use crate::{
arena::ArenaBuilder, config::Config, feed::OrnsteinUhlenbeck, strategy::Strategy,
types::PoolManager::PoolKey,
};

pub type AnvilProvider = FillProvider<
Expand Down Expand Up @@ -49,7 +48,7 @@ mod tests {
.with_strategy(Box::new(StrategyMock {}))
.with_pool(PoolKey {
currency0: Address::default(),
currency1: Address::default(),
currency1: Address::repeat_byte(1),
fee: 4000,
tickSpacing: 2,
hooks: Address::default(),
Expand Down

0 comments on commit ec636e5

Please sign in to comment.