pub trait StorageCreditsBackend {
type Error: StorageCreditsError;
// Required methods
fn gas_params(&self) -> &GasParams;
fn gas_tracker(&mut self) -> &mut GasTracker;
fn sload(
&mut self,
address: Address,
key: U256,
skip_cold_load: bool,
) -> Result<StateLoad<U256>, Self::Error>;
fn sstore(
&mut self,
address: Address,
key: U256,
value: U256,
skip_cold_load: bool,
) -> Result<StateLoad<SStoreResult>, Self::Error>;
fn tload(&mut self, address: Address, key: U256) -> U256;
fn tstore(&mut self, address: Address, key: U256, value: U256);
fn emit_event(
&mut self,
address: Address,
event: LogData,
) -> Result<(), Self::Error>;
// Provided method
fn charge_gas(&mut self, cost: u64) -> Result<(), Self::Error> { ... }
}Expand description
Minimal journal/gas operations required by storage credit accounting.
Required Associated Types§
Required Methods§
Sourcefn gas_params(&self) -> &GasParams
fn gas_params(&self) -> &GasParams
Gas parameters for the active spec.
Sourcefn gas_tracker(&mut self) -> &mut GasTracker
fn gas_tracker(&mut self) -> &mut GasTracker
Gas tracker for the active execution context.
Sourcefn sload(
&mut self,
address: Address,
key: U256,
skip_cold_load: bool,
) -> Result<StateLoad<U256>, Self::Error>
fn sload( &mut self, address: Address, key: U256, skip_cold_load: bool, ) -> Result<StateLoad<U256>, Self::Error>
SLOAD address[key], optionally skipping the cold load.
Sourcefn sstore(
&mut self,
address: Address,
key: U256,
value: U256,
skip_cold_load: bool,
) -> Result<StateLoad<SStoreResult>, Self::Error>
fn sstore( &mut self, address: Address, key: U256, value: U256, skip_cold_load: bool, ) -> Result<StateLoad<SStoreResult>, Self::Error>
SSTORE address[key].
Sourcefn emit_event(
&mut self,
address: Address,
event: LogData,
) -> Result<(), Self::Error>
fn emit_event( &mut self, address: Address, event: LogData, ) -> Result<(), Self::Error>
Emits event from address.
Provided Methods§
Sourcefn charge_gas(&mut self, cost: u64) -> Result<(), Self::Error>
fn charge_gas(&mut self, cost: u64) -> Result<(), Self::Error>
Charges cost regular gas, returning out_of_gas if insufficient.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".