Trait EstimateCall
pub trait EstimateCall: Call {
// Provided methods
fn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>
where S: StateProvider { ... }
fn estimate_gas_at(
&self,
request: TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send
where Self: LoadPendingBlock { ... }
fn map_out_of_gas_err<DB>(
&self,
env_gas_limit: Uint<256, 4>,
env: EnvWithHandlerCfg,
db: &mut DB,
) -> Self::Error
where DB: Database,
EthApiError: From<<DB as Database>::Error> { ... }
}
Expand description
Gas execution estimates
Provided Methods§
fn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>where
S: StateProvider,
fn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>where
S: StateProvider,
Estimates the gas usage of the request
with the state.
This will execute the TransactionRequest
and find the best gas limit via binary search.
§EVM settings
This modifies certain EVM settings to mirror geth’s SkipAccountChecks
when transacting requests, see also: https://github.com/ethereum/go-ethereum/blob/380688c636a654becc8f114438c2a5d93d2db032/core/state_transition.go#L145-L148:
disable_eip3607
is set totrue
disable_base_fee
is set totrue
nonce
is set toNone
fn estimate_gas_at(
&self,
request: TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
fn estimate_gas_at(
&self,
request: TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
Estimate gas needed for execution of the request
at the BlockId
.
fn map_out_of_gas_err<DB>(
&self,
env_gas_limit: Uint<256, 4>,
env: EnvWithHandlerCfg,
db: &mut DB,
) -> Self::Error
fn map_out_of_gas_err<DB>( &self, env_gas_limit: Uint<256, 4>, env: EnvWithHandlerCfg, db: &mut DB, ) -> Self::Error
Executes the requests again after an out of gas error to check if the error is gas related or not
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.