pub struct MockContext {
    pub ec: ExecutionContext,
    pub public_store: MockStore,
    pub confidential_store: MockStore,
    pub env: MockEnv,
    pub messages: Vec<Message>,
    pub events: Vec<Event>,
}Expand description
A mock contract context suitable for testing.
Fields§
§ec: ExecutionContextExecution context.
public_store: MockStorePublic store.
confidential_store: MockStore“Confidential” store.
env: MockEnvEnvironment.
messages: Vec<Message>Emitted messages.
events: Vec<Event>Emitted events.
Trait Implementations§
Source§impl Context for MockContext
 
impl Context for MockContext
Source§type PublicStore = MockStore
 
type PublicStore = MockStore
The public store.
Source§type ConfidentialStore = MockStore
 
type ConfidentialStore = MockStore
The confidential store.
Source§fn instance_id(&self) -> InstanceId
 
fn instance_id(&self) -> InstanceId
Contract instance identifier.
Source§fn instance_address(&self) -> &Address
 
fn instance_address(&self) -> &Address
Contract instance address.
Source§fn caller_address(&self) -> &Address
 
fn caller_address(&self) -> &Address
Caller address.
Source§fn deposited_tokens(&self) -> &[BaseUnits]
 
fn deposited_tokens(&self) -> &[BaseUnits]
Tokens deposited by the caller.
Source§fn is_read_only(&self) -> bool
 
fn is_read_only(&self) -> bool
Whether the call is read-only and must not make any storage modifications.
Source§fn call_format(&self) -> CallFormat
 
fn call_format(&self) -> CallFormat
Call format.
Source§fn emit_message(&mut self, msg: Message)
 
fn emit_message(&mut self, msg: Message)
Emits a message.
Source§fn emit_event<E: Event>(&mut self, event: E)
 
fn emit_event<E: Event>(&mut self, event: E)
Emits an event.
Source§fn public_store(&mut self) -> &mut Self::PublicStore
 
fn public_store(&mut self) -> &mut Self::PublicStore
Public contract store.
Source§fn confidential_store(&mut self) -> &mut Self::ConfidentialStore
 
fn confidential_store(&mut self) -> &mut Self::ConfidentialStore
Confidential contract store.
Source§impl From<ExecutionContext> for MockContext
 
impl From<ExecutionContext> for MockContext
Source§fn from(ec: ExecutionContext) -> Self
 
fn from(ec: ExecutionContext) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MockContext
impl RefUnwindSafe for MockContext
impl Send for MockContext
impl Sync for MockContext
impl Unpin for MockContext
impl UnwindSafe for MockContext
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more