@@ -468,15 +468,17 @@ async fn split_by_gas_limit(
468468 . function ( "reportResultBatch" )
469469 . and_then ( |f| f. encode_input ( & eth_report_result_batch_params. into_tokens ( ) ) ) ;
470470
471- let estimated_profit: Result < U256 , web3:: contract:: Error > = wrb_contract
471+ let params = (
472+ Token :: Array ( query_ids) ,
473+ Token :: Bytes ( eth_report_result_batch_msg_data. unwrap_or_default ( ) ) ,
474+ Token :: Uint ( eth_gas_price) ,
475+ Token :: Uint ( eth_nanowit_wei_price) ,
476+ ) ;
477+
478+ let estimated_profit: Result < ( U256 , U256 ) , web3:: contract:: Error > = wrb_contract
472479 . query (
473480 "estimateReportEarnings" ,
474- Token :: Tuple ( vec ! [
475- Token :: Tuple ( query_ids) ,
476- Token :: Bytes ( eth_report_result_batch_msg_data. unwrap_or_default( ) ) ,
477- Token :: Uint ( eth_gas_price) ,
478- Token :: Uint ( eth_nanowit_wei_price) ,
479- ] ) ,
481+ params,
480482 eth_from,
481483 contract:: Options :: with ( |opt| {
482484 opt. gas = eth_max_gas. map ( Into :: into) ;
@@ -487,13 +489,12 @@ async fn split_by_gas_limit(
487489 . await ;
488490
489491 match estimated_profit {
490- Ok ( estimated_profit ) if estimated_profit > U256 :: from ( 0 ) => {
492+ Ok ( ( revenues , expenses ) ) => {
491493 log:: debug!(
492- "reportResultBatch (x{} drs) estimated profit: {:? } ETH" ,
494+ "reportResultBatch (x{} drs) estimated profit: {} - { } ETH" ,
493495 batch_params. len( ) ,
494- Unit :: Wei ( & estimated_profit. to_string( ) )
495- . to_eth_str( )
496- . unwrap_or_default( ) ,
496+ Unit :: Wei ( & revenues. to_string( ) ) . to_eth_str( ) . unwrap_or_default( ) ,
497+ Unit :: Wei ( & expenses. to_string( ) ) . to_eth_str( ) . unwrap_or_default( ) ,
497498 ) ;
498499 v. push ( ( batch_params, estimated_gas) ) ;
499500 continue ;
0 commit comments