11use std:: {
22 ops:: Deref ,
3- sync:: { Arc , atomic:: AtomicU64 }
3+ sync:: { Arc , atomic:: AtomicU64 } ,
44} ;
55
66use alloy_primitives:: { B256 , FixedBytes } ;
77use dashmap:: { DashMap , mapref:: one:: Ref } ;
88use thiserror:: Error ;
99use tokio:: sync:: {
1010 Notify ,
11- futures:: { Notified , OwnedNotified }
11+ futures:: { Notified , OwnedNotified } ,
1212} ;
1313use uni_v4_structure:: BaselinePoolState ;
1414use uniswap_v3_math:: error:: UniswapV3MathError ;
1515
1616use crate :: {
1717 traits:: { PoolUpdateDelivery , PoolUpdateDeliveryExt } ,
18- updates:: PoolUpdate
18+ updates:: PoolUpdate ,
1919} ;
2020
2121#[ derive( Clone ) ]
2222pub struct UniswapPools {
23- pools : Arc < DashMap < PoolId , BaselinePoolState > > ,
23+ pools : Arc < DashMap < PoolId , BaselinePoolState > > ,
2424 // what block these are up to date for.
2525 block_number : Arc < AtomicU64 > ,
2626 // When the manager for the pools pushes a new block. It will notify all people who are
2727 // waiting.
28- notifier : Arc < Notify >
28+ notifier : Arc < Notify > ,
2929}
3030
3131impl Deref for UniswapPools {
@@ -41,7 +41,7 @@ impl UniswapPools {
4141 Self {
4242 pools,
4343 block_number : Arc :: new ( AtomicU64 :: from ( block_number) ) ,
44- notifier : Arc :: new ( Notify :: new ( ) )
44+ notifier : Arc :: new ( Notify :: new ( ) ) ,
4545 }
4646 }
4747
@@ -71,7 +71,7 @@ impl UniswapPools {
7171
7272 pub fn update_pools ( & self , mut updates : Vec < PoolUpdate > ) {
7373 if updates. is_empty ( ) {
74- return
74+ return ;
7575 }
7676
7777 let mut new_block_number = None ;
@@ -104,7 +104,7 @@ impl UniswapPools {
104104 state. update_liquidity (
105105 event. tick_lower ,
106106 event. tick_upper ,
107- event. liquidity_delta
107+ event. liquidity_delta ,
108108 ) ;
109109 }
110110 PoolUpdate :: FeeUpdate { pool_id, bundle_fee, swap_fee, protocol_fee, .. } => {
@@ -145,7 +145,7 @@ impl UniswapPools {
145145 }
146146 PoolUpdate :: Slot0Update ( update) => {
147147 if update. current_block != update. current_block {
148- continue
148+ continue ;
149149 }
150150
151151 let Some ( mut pool) = self . pools . get_mut ( & update. angstrom_pool_id ) else {
@@ -155,7 +155,7 @@ impl UniswapPools {
155155 pool. value_mut ( ) . update_slot0 (
156156 update. tick ,
157157 update. sqrt_price_x96 . into ( ) ,
158- update. liquidity
158+ update. liquidity ,
159159 ) ;
160160 }
161161 _ => { }
@@ -210,7 +210,7 @@ pub enum SwapSimulationError {
210210 #[ error( "Invalid sqrt price limit" ) ]
211211 InvalidSqrtPriceLimit ,
212212 #[ error( "Amount specified must be non-zero" ) ]
213- ZeroAmountSpecified
213+ ZeroAmountSpecified ,
214214}
215215
216216#[ derive( Error , Debug ) ]
@@ -230,5 +230,5 @@ pub enum PoolError {
230230 #[ error( transparent) ]
231231 AlloySolTypeError ( #[ from] alloy:: sol_types:: Error ) ,
232232 #[ error( transparent) ]
233- Eyre ( #[ from] eyre:: Error )
233+ Eyre ( #[ from] eyre:: Error ) ,
234234}
0 commit comments