Skip to content

Commit

Permalink
fix: fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
louise-poole committed Nov 26, 2024
1 parent fc1f8c5 commit bd16d3a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
9 changes: 6 additions & 3 deletions examples/explorer/data_feed/tycho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use tycho_simulation::{
vm::{
engine::{update_engine, SHARED_TYCHO_DB},
state::VMPoolState,
tycho_decoder::TryFromWithBlock,
},
},
};
Expand Down Expand Up @@ -258,7 +257,9 @@ pub async fn process_messages(
snapshot.clone(),
header.clone(),
HashMap::new(),
) {
)
.await
{
Ok(state) => Box::new(state),
Err(e) => {
debug!(
Expand All @@ -272,7 +273,9 @@ pub async fn process_messages(
snapshot.clone(),
header.clone(),
HashMap::new(),
) {
)
.await
{
Ok(state) => Box::new(state),
Err(e) => {
warn!(
Expand Down
16 changes: 11 additions & 5 deletions src/protocol/uniswap_v2/tycho_decoder.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
use ethers::types::U256;
use std::collections::HashMap;

use ethers::types::{H160, U256};

use tycho_client::feed::{synchronizer::ComponentWithState, Header};
use tycho_ethereum::BytesCodec;

use crate::protocol::{
errors::InvalidSnapshotError, models::TryFromWithBlock, uniswap_v2::state::UniswapV2State,
use crate::{
models::ERC20Token,
protocol::{
errors::InvalidSnapshotError, models::TryFromWithBlock, uniswap_v2::state::UniswapV2State,
},
};

impl TryFromWithBlock<ComponentWithState> for UniswapV2State {
Expand All @@ -15,6 +20,7 @@ impl TryFromWithBlock<ComponentWithState> for UniswapV2State {
async fn try_from_with_block(
snapshot: ComponentWithState,
_block: Header,
_all_tokens: HashMap<H160, ERC20Token>,
) -> Result<Self, Self::Error> {
let reserve0 = U256::from_bytes(
snapshot
Expand Down Expand Up @@ -93,7 +99,7 @@ mod tests {
component: usv2_component(),
};

let result = UniswapV2State::try_from_with_block(snapshot, header()).await;
let result = UniswapV2State::try_from_with_block(snapshot, header(), HashMap::new()).await;

assert!(result.is_ok());
let res = result.unwrap();
Expand All @@ -116,7 +122,7 @@ mod tests {
component: usv2_component(),
};

let result = UniswapV2State::try_from_with_block(snapshot, header()).await;
let result = UniswapV2State::try_from_with_block(snapshot, header(), HashMap::new()).await;

assert!(result.is_err());

Expand Down
22 changes: 14 additions & 8 deletions src/protocol/uniswap_v3/tycho_decoder.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
use ethers::types::U256;
use std::collections::HashMap;

use ethers::types::{H160, U256};

use tycho_client::feed::{synchronizer::ComponentWithState, Header};
use tycho_core::Bytes;
use tycho_ethereum::BytesCodec;

use crate::protocol::{
errors::InvalidSnapshotError,
models::TryFromWithBlock,
uniswap_v3::{enums::FeeAmount, state::UniswapV3State, tick_list::TickInfo},
use crate::{
models::ERC20Token,
protocol::{
errors::InvalidSnapshotError,
models::TryFromWithBlock,
uniswap_v3::{enums::FeeAmount, state::UniswapV3State, tick_list::TickInfo},
},
};

impl TryFromWithBlock<ComponentWithState> for UniswapV3State {
Expand All @@ -18,6 +23,7 @@ impl TryFromWithBlock<ComponentWithState> for UniswapV3State {
async fn try_from_with_block(
snapshot: ComponentWithState,
_block: Header,
_all_tokens: HashMap<H160, ERC20Token>,
) -> Result<Self, Self::Error> {
let liq = snapshot
.state
Expand Down Expand Up @@ -214,7 +220,7 @@ mod tests {
component: usv3_component(),
};

let result = UniswapV3State::try_from_with_block(snapshot, header()).await;
let result = UniswapV3State::try_from_with_block(snapshot, header(), HashMap::new()).await;

assert!(result.is_ok());
let expected = UniswapV3State::new(
Expand Down Expand Up @@ -263,7 +269,7 @@ mod tests {
component,
};

let result = UniswapV3State::try_from_with_block(snapshot, header()).await;
let result = UniswapV3State::try_from_with_block(snapshot, header(), HashMap::new()).await;

assert!(result.is_err());
assert!(matches!(
Expand All @@ -289,7 +295,7 @@ mod tests {
component,
};

let result = UniswapV3State::try_from_with_block(snapshot, header()).await;
let result = UniswapV3State::try_from_with_block(snapshot, header(), HashMap::new()).await;

assert!(result.is_err());
assert!(matches!(
Expand Down

0 comments on commit bd16d3a

Please sign in to comment.