@@ -476,6 +476,46 @@ func GetFilteredSlots(filter *dbtypes.BlockFilter, firstSlot uint64, offset uint
476476 fmt .Fprintf (& sql , ` AND slots.eth_block_hash = $%v ` , argIdx )
477477 args = append (args , filter .EthBlockHash )
478478 }
479+ if filter .MinGasUsed != nil {
480+ argIdx ++
481+ fmt .Fprintf (& sql , ` AND slots.eth_gas_used >= $%v ` , argIdx )
482+ args = append (args , * filter .MinGasUsed )
483+ }
484+ if filter .MaxGasUsed != nil {
485+ argIdx ++
486+ fmt .Fprintf (& sql , ` AND slots.eth_gas_used <= $%v ` , argIdx )
487+ args = append (args , * filter .MaxGasUsed )
488+ }
489+ if filter .MinGasLimit != nil {
490+ argIdx ++
491+ fmt .Fprintf (& sql , ` AND slots.eth_gas_limit >= $%v ` , argIdx )
492+ args = append (args , * filter .MinGasLimit )
493+ }
494+ if filter .MaxGasLimit != nil {
495+ argIdx ++
496+ fmt .Fprintf (& sql , ` AND slots.eth_gas_limit <= $%v ` , argIdx )
497+ args = append (args , * filter .MaxGasLimit )
498+ }
499+ if filter .MinBlockSize != nil {
500+ argIdx ++
501+ fmt .Fprintf (& sql , ` AND slots.block_size >= $%v ` , argIdx )
502+ args = append (args , * filter .MinBlockSize )
503+ }
504+ if filter .MaxBlockSize != nil {
505+ argIdx ++
506+ fmt .Fprintf (& sql , ` AND slots.block_size <= $%v ` , argIdx )
507+ args = append (args , * filter .MaxBlockSize )
508+ }
509+ if filter .MinSlot != nil {
510+ argIdx ++
511+ fmt .Fprintf (& sql , ` AND slots.slot >= $%v ` , argIdx )
512+ args = append (args , * filter .MinSlot )
513+ }
514+ if filter .MaxSlot != nil {
515+ argIdx ++
516+ fmt .Fprintf (& sql , ` AND slots.slot <= $%v ` , argIdx )
517+ args = append (args , * filter .MaxSlot )
518+ }
479519
480520 fmt .Fprintf (& sql , ` ORDER BY slots.slot DESC ` )
481521 fmt .Fprintf (& sql , ` LIMIT $%v OFFSET $%v ` , argIdx + 1 , argIdx + 2 )
0 commit comments