github.com/ChainSafe/chainbridge-core@v1.4.2/chains/evm/calls/evmgaspricer/gas-pricer.go (about) 1 package evmgaspricer 2 3 import ( 4 "context" 5 "math/big" 6 ) 7 8 type LondonGasClient interface { 9 GasPriceClient 10 BaseFee() (*big.Int, error) 11 SuggestGasTipCap(ctx context.Context) (*big.Int, error) 12 } 13 14 type GasPriceClient interface { 15 SuggestGasPrice(ctx context.Context) (*big.Int, error) 16 } 17 18 // GasPricerOpts is the structure that holds parameters that could be used to configure different gasPRicer implementation 19 type GasPricerOpts struct { 20 UpperLimitFeePerGas *big.Int // UpperLimitFeePerGas in Static and London gasPricer limits the maximum gas price that could be used. In London gasPricer if BaseFee > UpperLimitFeePerGas, then maxFeeCap will be BaseFee + 2.5 Gwei for MaxTipCap. If nil - not applied 21 GasPriceFactor *big.Float // GasPriceFactor In static gasPricer multiplies final gasPrice. Could be for example 0.75 or 5. 22 Args []interface{} // Args is the array of dynamic typed args that could be used for other custom GasPricer implementations 23 } 24 25 func multiplyGasPrice(gasEstimate *big.Int, gasMultiplier *big.Float) *big.Int { 26 gasEstimateFloat := new(big.Float).SetInt(gasEstimate) 27 result := gasEstimateFloat.Mul(gasEstimateFloat, gasMultiplier) 28 gasPrice := new(big.Int) 29 result.Int(gasPrice) 30 return gasPrice 31 }