referrerpolicy=no-referrer-when-downgrade

FrameMeter

Type Alias FrameMeter 

Source
pub type FrameMeter<T> = ResourceMeter<T, Nested>;
Expand description

The type of resource meter used for an execution frame.

Aliased Type§

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

Implementations§

Source§

impl<T: Config> FrameMeter<T>

Source

pub fn charge_contract_deposit_and_transfer( &mut self, contract: T::AccountId, amount: StorageDeposit<BalanceOf<T>>, ) -> DispatchResult

Record a contract’s storage deposit and schedule the transfer.

Updates the frame’s deposit accounting and schedules the actual token transfer for later execution – at the end of the transaction execution.

Source

pub fn record_contract_storage_changes(&mut self, diff: &Diff) -> DispatchResult

Record storage changes of a contract.

Source

pub fn finalize(&mut self, info: Option<&mut ContractInfo<T>>) -> DispatchResult

Self::charge_contract_deposit_and_transfer and Self::record_contract_storage_changes does not enforce the storage limit since we want to do this check as late as possible to allow later refunds to offset earlier charges.

Source

pub fn apply_pending_storage_changes(&self, info: &mut ContractInfo<T>)

Apply pending storage changes to a ContractInfo without finalizing the meter.

This is used before creating a nested frame to ensure the child frame can see the parent’s pending storage changes when calculating refunds. This fixes the issue where storage deposit refunds fail in subframes because the parent’s pending charges haven’t been committed to ContractInfo yet.

See: https://github.com/paritytech/contract-issues/issues/213