diff --git a/examples/price_printer/main.rs b/examples/price_printer/main.rs index 05617c51..7cf975ff 100644 --- a/examples/price_printer/main.rs +++ b/examples/price_printer/main.rs @@ -8,7 +8,7 @@ use clap::Parser; use futures::{future::select_all, StreamExt}; use tokio::{sync::mpsc, task::JoinHandle}; use tycho_client::feed::component_tracker::ComponentFilter; -use tycho_core::dto::Chain; +use tycho_core::models::Chain; use tycho_simulation::{ evm::{ engine_db::tycho_db::PreCachedDB, diff --git a/examples/price_printer/utils.rs b/examples/price_printer/utils.rs index 371f6121..37b7d591 100644 --- a/examples/price_printer/utils.rs +++ b/examples/price_printer/utils.rs @@ -1,5 +1,5 @@ use tracing_subscriber::{fmt, EnvFilter}; -use tycho_core::dto::Chain; +use tycho_core::models::Chain; pub fn setup_tracing() { let writer = tracing_appender::rolling::daily("logs", "price_printer.log"); diff --git a/examples/quickstart/main.rs b/examples/quickstart/main.rs index e0e40a9f..cb321fc7 100644 --- a/examples/quickstart/main.rs +++ b/examples/quickstart/main.rs @@ -17,7 +17,7 @@ use tycho_simulation::{ models::Token, protocol::models::BlockUpdate, tycho_client::feed::component_tracker::ComponentFilter, - tycho_core::dto::Chain, + tycho_core::models::Chain, utils::load_all_tokens, }; diff --git a/src/evm/stream.rs b/src/evm/stream.rs index f86de6d8..ca942ebf 100644 --- a/src/evm/stream.rs +++ b/src/evm/stream.rs @@ -6,7 +6,7 @@ use tycho_client::{ feed::{component_tracker::ComponentFilter, synchronizer::ComponentWithState}, stream::{StreamError, TychoStreamBuilder}, }; -use tycho_core::{dto::Chain, Bytes}; +use tycho_core::{models::Chain, Bytes}; use crate::{ evm::decoder::{StreamDecodeError, TychoStreamDecoder}, @@ -56,7 +56,7 @@ impl ProtocolStreamBuilder { pub fn new(tycho_url: &str, chain: Chain) -> Self { Self { decoder: TychoStreamDecoder::new(), - stream_builder: TychoStreamBuilder::new(tycho_url, chain), + stream_builder: TychoStreamBuilder::new(tycho_url, chain.into()), } } diff --git a/src/evm/tycho_models.rs b/src/evm/tycho_models.rs index c53620b1..eb8e6692 100644 --- a/src/evm/tycho_models.rs +++ b/src/evm/tycho_models.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt::Display}; use alloy_primitives::{Address, B256, U256}; use chrono::{NaiveDateTime, Utc}; use serde::{Deserialize, Serialize}; -pub use tycho_core::dto::{Chain, ChangeType}; +pub use tycho_core::{dto::ChangeType, models::Chain}; use uuid::Uuid; use super::engine_db::simulation_db::BlockHeader; @@ -138,7 +138,7 @@ impl AccountUpdate { impl From for AccountUpdate { fn from(value: tycho_core::dto::AccountUpdate) -> Self { Self { - chain: value.chain, + chain: value.chain.into(), address: Address::from_slice(&value.address[..20]), // Convert address field to Address slots: u256_num::map_slots_to_u256(value.slots), balance: value @@ -260,7 +260,7 @@ impl std::fmt::Debug for ResponseAccount { impl From for ResponseAccount { fn from(value: tycho_core::dto::ResponseAccount) -> Self { Self { - chain: value.chain, + chain: value.chain.into(), address: Address::from_slice(&value.address[..20]), // Convert address field to Address title: value.title.clone(), slots: u256_num::map_slots_to_u256(value.slots), diff --git a/src/protocol/models.rs b/src/protocol/models.rs index cc13e1b2..bb5840cb 100644 --- a/src/protocol/models.rs +++ b/src/protocol/models.rs @@ -29,7 +29,7 @@ use std::{collections::HashMap, default::Default, future::Future}; use chrono::NaiveDateTime; use num_bigint::BigUint; use tycho_client::feed::Header; -use tycho_core::{dto::Chain, Bytes}; +use tycho_core::{models::Chain, Bytes}; use super::state::ProtocolSim; use crate::models::Token; @@ -93,7 +93,7 @@ impl ProtocolComponent { id.clone(), core_model.protocol_system, core_model.protocol_type_name, - core_model.chain, + core_model.chain.into(), tokens, core_model.contract_ids, core_model.static_attributes, @@ -109,7 +109,7 @@ impl From for tycho_core::dto::ProtocolComponent { id: hex::encode(component.id), protocol_system: component.protocol_system, protocol_type_name: component.protocol_type_name, - chain: component.chain, + chain: component.chain.into(), tokens: component .tokens .into_iter() diff --git a/src/utils.rs b/src/utils.rs index 9786dab7..cf61af1a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use tracing::info; use tycho_client::{rpc::RPCClient, HttpRPCClient}; -use tycho_core::{dto::Chain, Bytes}; +use tycho_core::{models::Chain, Bytes}; use crate::{models::Token, protocol::errors::SimulationError}; @@ -66,7 +66,7 @@ pub async fn load_all_tokens( #[allow(clippy::mutable_key_type)] rpc_client .get_all_tokens( - chain, + chain.into(), min_quality.or(Some(100)), max_days_since_last_trade.or(default_min_days .get(&chain)