Struct boot_core::Mock

source ·
pub struct Mock<S: StateInterface = MockState> {
    pub sender: Addr,
    pub state: Rc<RefCell<S>>,
    pub app: Rc<RefCell<App>>,
}

Fields§

§sender: Addr§state: Rc<RefCell<S>>§app: Rc<RefCell<App>>

Implementations§

source§

impl<S: StateInterface> Mock<S>

source

pub fn set_balance( &self, address: &Addr, amount: Vec<Coin> ) -> Result<(), BootError>

set the Bank balance of an address

source

pub fn set_balances( &self, balances: &[(&Addr, &[Coin])] ) -> Result<(), BootError>

source

pub fn query_balance( &self, address: &Addr, denom: &str ) -> Result<Uint128, BootError>

Query the balance of a native token for and address Returns the amount of the native token

source

pub fn query_all_balances(&self, address: &Addr) -> Result<Vec<Coin>, BootError>

Query all balances of the address Returns a vector of coins

source§

impl<S: StateInterface> Mock<S>

source

pub fn new( sender: &Addr, state: &Rc<RefCell<S>>, app: &Rc<RefCell<App>> ) -> Result<Self>

Trait Implementations§

source§

impl<T: BootExecute<Mock> + ContractInstance<Mock> + Clone> CallAs<Mock<MockState>> for T

§

type Sender = Addr

source§

fn set_sender(&mut self, sender: &Addr)

Set the sender for the contract
source§

fn call_as(&self, sender: &Self::Sender) -> Self

Call a contract as a different sender.
Creates a new copy of the contract with a different sender
source§

impl<S: StateInterface> ChainState for Mock<S>

§

type Out = Rc<RefCell<S>>

source§

fn state(&self) -> Self::Out

source§

impl<S: Clone + StateInterface> Clone for Mock<S>

source§

fn clone(&self) -> Mock<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: StateInterface> TxHandler for Mock<S>

§

type Response = AppResponse

§

type Error = BootError

source§

fn sender(&self) -> Addr

source§

fn execute<E: Serialize + Debug>( &self, exec_msg: &E, coins: &[Coin], contract_address: &Addr ) -> Result<Self::Response, BootError>

source§

fn instantiate<I: Serialize + Debug>( &self, code_id: u64, init_msg: &I, label: Option<&str>, admin: Option<&Addr>, coins: &[Coin] ) -> Result<Self::Response, BootError>

source§

fn query<Q: Serialize + Debug, T: Serialize + DeserializeOwned>( &self, query_msg: &Q, contract_address: &Addr ) -> Result<T, BootError>

source§

fn migrate<M: Serialize + Debug>( &self, migrate_msg: &M, new_code_id: u64, contract_address: &Addr ) -> Result<Self::Response, BootError>

source§

fn upload( &self, contract_source: &mut ContractCodeReference<Empty> ) -> Result<Self::Response, BootError>

source§

fn wait_blocks(&self, amount: u64) -> Result<(), BootError>

source§

fn next_block(&self) -> Result<(), BootError>

source§

fn block_info(&self) -> Result<BlockInfo, BootError>

Auto Trait Implementations§

§

impl<S = MockState> !RefUnwindSafe for Mock<S>

§

impl<S = MockState> !Send for Mock<S>

§

impl<S = MockState> !Sync for Mock<S>

§

impl<S> Unpin for Mock<S>

§

impl<S = MockState> !UnwindSafe for Mock<S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<M> AsAny for Mwhere M: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> BootEnvironment for Twhere T: TxHandler + Clone,

source§

impl<T> CwEnv for Twhere T: TxHandler + Clone,