@@ -428,8 +428,7 @@ async fn partial_fills(web3: Web3) {
428428 let [ solver] = onchain. make_solvers ( to_wei ( 1 ) ) . await ;
429429 let [ trader] = onchain. make_accounts ( to_wei ( 3 ) ) . await ;
430430
431- let counter = contracts:: test:: Counter :: builder ( & web3)
432- . deploy ( )
431+ let counter = contracts:: alloy:: test:: Counter :: Instance :: deploy ( web3. alloy . clone ( ) )
433432 . await
434433 . unwrap ( ) ;
435434
@@ -454,6 +453,20 @@ async fn partial_fills(web3: Web3) {
454453 let services = Services :: new ( & onchain) . await ;
455454 services. start_protocol ( solver) . await ;
456455
456+ let pre_inc = counter. incrementCounter ( "pre" . to_string ( ) ) ;
457+ let pre_hook = Hook {
458+ target : counter. address ( ) . into_legacy ( ) ,
459+ call_data : pre_inc. calldata ( ) . to_vec ( ) ,
460+ gas_limit : pre_inc. estimate_gas ( ) . await . unwrap ( ) ,
461+ } ;
462+
463+ let post_inc = counter. incrementCounter ( "post" . to_string ( ) ) ;
464+ let post_hook = Hook {
465+ target : counter. address ( ) . into_legacy ( ) ,
466+ call_data : post_inc. calldata ( ) . to_vec ( ) ,
467+ gas_limit : post_inc. estimate_gas ( ) . await . unwrap ( ) ,
468+ } ;
469+
457470 tracing:: info!( "Placing order" ) ;
458471 let order = OrderCreation {
459472 sell_token : onchain. contracts ( ) . weth . address ( ) ,
@@ -467,8 +480,8 @@ async fn partial_fills(web3: Web3) {
467480 full : json ! ( {
468481 "metadata" : {
469482 "hooks" : {
470- "pre" : [ hook_for_transaction ( counter . increment_counter ( "pre" . to_string ( ) ) . tx ) . await ] ,
471- "post" : [ hook_for_transaction ( counter . increment_counter ( "post" . to_string ( ) ) . tx ) . await ] ,
483+ "pre" : [ pre_hook ] ,
484+ "post" : [ post_hook ] ,
472485 } ,
473486 } ,
474487 } )
@@ -496,13 +509,10 @@ async fn partial_fills(web3: Web3) {
496509 == 0 . into ( )
497510 } ;
498511 wait_for_condition ( TIMEOUT , trade_happened) . await . unwrap ( ) ;
499- assert_eq ! (
500- counter. counters( "pre" . to_string( ) ) . call( ) . await . unwrap( ) ,
501- 1 . into( )
502- ) ;
512+ assert_eq ! ( counter. counters( "pre" . to_string( ) ) . call( ) . await . unwrap( ) , 1 ) ;
503513 assert_eq ! (
504514 counter. counters( "post" . to_string( ) ) . call( ) . await . unwrap( ) ,
505- 1 . into ( )
515+ 1
506516 ) ;
507517
508518 tracing:: info!( "Fund remaining sell balance." ) ;
@@ -514,13 +524,10 @@ async fn partial_fills(web3: Web3) {
514524
515525 tracing:: info!( "Waiting for second trade." ) ;
516526 wait_for_condition ( TIMEOUT , trade_happened) . await . unwrap ( ) ;
517- assert_eq ! (
518- counter. counters( "pre" . to_string( ) ) . call( ) . await . unwrap( ) ,
519- 1 . into( )
520- ) ;
527+ assert_eq ! ( counter. counters( "pre" . to_string( ) ) . call( ) . await . unwrap( ) , 1 ) ;
521528 assert_eq ! (
522529 counter. counters( "post" . to_string( ) ) . call( ) . await . unwrap( ) ,
523- 2 . into ( )
530+ 2
524531 ) ;
525532}
526533
0 commit comments