@@ -86,24 +86,39 @@ pub enum TransactGasPrice {
8686 max_priority : U256 ,
8787 /// `max_fee_per_gas` according to EIP-1559.
8888 max : U256 ,
89- }
89+ } ,
9090}
9191
9292impl TransactGasPrice {
9393 /// Caller fee.
94- pub fn fee < H : RuntimeEnvironment > ( & self , gas_limit : U256 , config : & Config , handler : & H ) -> U256 {
94+ pub fn fee < H : RuntimeEnvironment > (
95+ & self ,
96+ gas_limit : U256 ,
97+ config : & Config ,
98+ handler : & H ,
99+ ) -> U256 {
95100 let effective_gas_price = self . effective_gas_price ( config, handler) ;
96101 gas_limit. saturating_mul ( effective_gas_price)
97102 }
98103
99104 /// Refunded caller fee after call.
100- pub fn refunded_fee < H : RuntimeEnvironment > ( & self , refunded_gas : U256 , config : & Config , handler : & H ) -> U256 {
105+ pub fn refunded_fee < H : RuntimeEnvironment > (
106+ & self ,
107+ refunded_gas : U256 ,
108+ config : & Config ,
109+ handler : & H ,
110+ ) -> U256 {
101111 let effective_gas_price = self . effective_gas_price ( config, handler) ;
102112 refunded_gas. saturating_mul ( effective_gas_price)
103113 }
104114
105115 /// Coinbase reward.
106- pub fn coinbase_reward < H : RuntimeEnvironment > ( & self , used_gas : U256 , config : & Config , handler : & H ) -> U256 {
116+ pub fn coinbase_reward < H : RuntimeEnvironment > (
117+ & self ,
118+ used_gas : U256 ,
119+ config : & Config ,
120+ handler : & H ,
121+ ) -> U256 {
107122 if config. eip1559_fee_market {
108123 let max_priority = match self {
109124 Self :: Legacy ( gas_price) => * gas_price,
@@ -113,7 +128,10 @@ impl TransactGasPrice {
113128 Self :: Legacy ( gas_price) => * gas_price,
114129 Self :: FeeMarket { max, .. } => * max,
115130 } ;
116- let priority = min ( max_priority, max. saturating_sub ( handler. block_base_fee_per_gas ( ) ) ) ;
131+ let priority = min (
132+ max_priority,
133+ max. saturating_sub ( handler. block_base_fee_per_gas ( ) ) ,
134+ ) ;
117135 used_gas. saturating_mul ( priority)
118136 } else {
119137 let effective_gas_price = self . effective_gas_price ( config, handler) ;
@@ -133,14 +151,16 @@ impl TransactGasPrice {
133151 Self :: FeeMarket { max, .. } => * max,
134152 } ;
135153
136- let priority = min ( max_priority, max. saturating_sub ( handler. block_base_fee_per_gas ( ) ) ) ;
154+ let priority = min (
155+ max_priority,
156+ max. saturating_sub ( handler. block_base_fee_per_gas ( ) ) ,
157+ ) ;
137158 priority. saturating_add ( handler. block_base_fee_per_gas ( ) )
138159 } else {
139160 match self {
140161 Self :: Legacy ( gas_price) => * gas_price,
141162 Self :: FeeMarket { max_priority, .. } => * max_priority,
142163 }
143-
144164 }
145165 }
146166}
@@ -263,7 +283,11 @@ where
263283 > {
264284 let caller = AsRef :: < TransactArgs > :: as_ref ( & args) . caller ;
265285 let gas_price = AsRef :: < TransactArgs > :: as_ref ( & args) . gas_price ;
266- let gas_fee = gas_price. fee ( AsRef :: < TransactArgs > :: as_ref ( & args) . gas_limit , AsRef :: < TransactArgs > :: as_ref ( & args) . config , handler) ;
286+ let gas_fee = gas_price. fee (
287+ AsRef :: < TransactArgs > :: as_ref ( & args) . gas_limit ,
288+ AsRef :: < TransactArgs > :: as_ref ( & args) . config ,
289+ handler,
290+ ) ;
267291 let coinbase = handler. block_coinbase ( ) ;
268292
269293 let address = match & AsRef :: < TransactArgs > :: as_ref ( & args) . call_create {
@@ -352,7 +376,8 @@ where
352376 } ;
353377 let transaction_context = TransactionContext {
354378 origin : caller,
355- gas_price : gas_price. effective_gas_price ( AsRef :: < TransactArgs > :: as_ref ( & args) . config , handler) ,
379+ gas_price : gas_price
380+ . effective_gas_price ( AsRef :: < TransactArgs > :: as_ref ( & args) . config , handler) ,
356381 } ;
357382 let transfer = Transfer {
358383 source : caller,
@@ -499,9 +524,13 @@ where
499524 }
500525
501526 let used_gas = invoke. gas_limit . saturating_sub ( effective_gas) ;
502- let refunded_fee = invoke. gas_price . refunded_fee ( effective_gas, invoke. config , handler) ;
527+ let refunded_fee = invoke
528+ . gas_price
529+ . refunded_fee ( effective_gas, invoke. config , handler) ;
503530 handler. deposit ( invoke. caller , refunded_fee) ;
504- let coinbase_reward = invoke. gas_price . coinbase_reward ( used_gas, invoke. config , handler) ;
531+ let coinbase_reward = invoke
532+ . gas_price
533+ . coinbase_reward ( used_gas, invoke. config , handler) ;
505534 handler. deposit ( handler. block_coinbase ( ) , coinbase_reward) ;
506535
507536 result. map ( |call_create| TransactValue {
0 commit comments