TransactionMeter

Type Alias TransactionMeter 

Source
pub type TransactionMeter<T> = ResourceMeter<T, Root>;
Expand description

The type of resource meter used at the root level for transactions as a whole.

Aliased Type§

pub struct TransactionMeter<T> { /* private fields */ }

Implementations§

Source§

impl<T: Config> TransactionMeter<T>

Source

pub fn new( transaction_limits: TransactionLimits<T>, ) -> Result<Self, DispatchError>

Create a new transaction-level meter with the specified resource limits.

Initializes either:

  • An ethereum-style gas-based meter or
  • A substrate-style meter with explicit weight and deposit limits
Source

pub fn new_from_limits( weight_limit: Weight, deposit_limit: BalanceOf<T>, ) -> Result<Self, DispatchError>

Convenience constructor for substrate-style weight+deposit limits.

Source

pub fn execute_postponed_deposits( &mut self, origin: &Origin<T>, exec_config: &ExecConfig<T>, ) -> Result<StorageDeposit<BalanceOf<T>>, DispatchError>

Execute all postponed storage deposit operations.

Returns Err(Error::StorageDepositNotEnoughFunds) if deposit limit would be exceeded.

Source

pub fn terminate( &mut self, contract_account: T::AccountId, refunded: BalanceOf<T>, )

Mark a contract as terminated

This will signal to the meter to discard all charged and refunds incured by this contract. Furthermore it will record that there was a refund of refunded and adapt the total deposit accordingly