1212 db:: DB ,
1313 entities:: ChainId ,
1414 } ,
15+ state:: Store ,
1516 } ,
1617 mockall_double:: double,
1718 solana_client:: {
@@ -93,6 +94,7 @@ pub struct Config {
9394}
9495
9596pub struct ServiceInner {
97+ store : Arc < Store > ,
9698 opportunity_service : Arc < OpportunityService > ,
9799 config : Config ,
98100 repo : Arc < Repository > ,
@@ -111,13 +113,15 @@ impl std::ops::Deref for Service {
111113
112114impl Service {
113115 pub fn new (
116+ store : Arc < Store > ,
114117 db : DB ,
115118 config : Config ,
116119 opportunity_service : Arc < OpportunityService > ,
117120 task_tracker : TaskTracker ,
118121 event_sender : broadcast:: Sender < UpdateEvent > ,
119122 ) -> Self {
120123 Self ( Arc :: new ( ServiceInner {
124+ store,
121125 repo : Arc :: new ( repository:: Repository :: new ( db, config. chain_id . clone ( ) ) ) ,
122126 config,
123127 opportunity_service,
@@ -254,11 +258,13 @@ pub mod tests {
254258 ServiceInner ,
255259 } ,
256260 crate :: {
261+ api:: ws,
257262 auction:: repository:: {
258263 Database ,
259264 Repository ,
260265 } ,
261266 kernel:: {
267+ db:: DB ,
262268 entities:: ChainId ,
263269 traced_sender_svm:: {
264270 tests:: MockRpcClient ,
@@ -270,14 +276,21 @@ pub mod tests {
270276 get_submit_bid_instruction_account_positions,
271277 get_swap_instruction_account_positions,
272278 } ,
279+ state:: Store ,
273280 } ,
274281 solana_client:: {
275282 nonblocking:: rpc_client:: RpcClient ,
276283 rpc_client:: RpcClientConfig ,
277284 } ,
278285 solana_sdk:: signature:: Keypair ,
279- std:: sync:: Arc ,
280- tokio:: sync:: broadcast,
286+ std:: {
287+ collections:: HashMap ,
288+ sync:: Arc ,
289+ } ,
290+ tokio:: sync:: {
291+ broadcast,
292+ RwLock ,
293+ } ,
281294 tokio_util:: task:: TaskTracker ,
282295 } ;
283296
@@ -289,9 +302,18 @@ pub mod tests {
289302 rpc_client : MockRpcClient ,
290303 broadcaster_client : MockRpcClient ,
291304 ) -> Self {
305+ let store = Arc :: new ( Store {
306+ db : DB :: connect_lazy ( "https://test" ) . unwrap ( ) ,
307+ chains_svm : HashMap :: new ( ) ,
308+ ws : ws:: WsState :: new ( "X-Forwarded-For" . to_string ( ) , 100 ) ,
309+ secret_key : "test" . to_string ( ) ,
310+ access_tokens : RwLock :: new ( HashMap :: new ( ) ) ,
311+ privileges : RwLock :: new ( HashMap :: new ( ) ) ,
312+ } ) ;
292313 Service ( Arc :: new ( ServiceInner {
314+ store,
293315 opportunity_service : Arc :: new ( opportunity_service) ,
294- config : Config {
316+ config : Config {
295317 chain_id : chain_id. clone ( ) ,
296318 chain_config : ConfigSvm {
297319 client : RpcClient :: new_sender (
@@ -322,9 +344,9 @@ pub mod tests {
322344 prioritization_fee_percentile : None ,
323345 } ,
324346 } ,
325- repo : Arc :: new ( Repository :: new ( db, chain_id. clone ( ) ) ) ,
326- task_tracker : TaskTracker :: new ( ) ,
327- event_sender : broadcast:: channel ( 1 ) . 0 ,
347+ repo : Arc :: new ( Repository :: new ( db, chain_id. clone ( ) ) ) ,
348+ task_tracker : TaskTracker :: new ( ) ,
349+ event_sender : broadcast:: channel ( 1 ) . 0 ,
328350 } ) )
329351 }
330352 }
0 commit comments