referrerpolicy=no-referrer-when-downgrade
pallet_contracts::debug

Trait CallInterceptor

Source
pub trait CallInterceptor<T: Config> {
    // Required method
    fn intercept_call(
        contract_address: &T::AccountId,
        entry_point: &ExportedFunction,
        input_data: &[u8],
    ) -> Option<ExecResult>;
}
Expand description

Provides an interface for intercepting contract calls.

Required Methods§

Source

fn intercept_call( contract_address: &T::AccountId, entry_point: &ExportedFunction, input_data: &[u8], ) -> Option<ExecResult>

Allows to intercept contract calls and decide whether they should be executed or not. If the call is intercepted, the mocked result of the call is returned.

§Arguments
  • contract_address - The address of the contract that is about to be executed.
  • entry_point - Describes whether the call is the constructor or a regular call.
  • input_data - The raw input data of the call.
§Expected behavior

This method should return:

  • Some(ExecResult) - if the call should be intercepted and the mocked result of the call is returned.
  • None - otherwise, i.e. the call should be executed normally.

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.

Implementations on Foreign Types§

Source§

impl<T: Config> CallInterceptor<T> for ()

Source§

fn intercept_call( _contract_address: &T::AccountId, _entry_point: &ExportedFunction, _input_data: &[u8], ) -> Option<ExecResult>

Implementors§