pub struct TgradeApp(/* private fields */);Implementations§
Source§impl TgradeApp
impl TgradeApp
pub fn new(owner: &str) -> Self
pub fn new_genesis(owner: &str) -> Self
pub fn block_info(&self) -> BlockInfo
pub fn promote(&mut self, owner: &str, contract: &str) -> AnyResult<AppResponse>
Sourcepub fn back_to_genesis(&mut self)
pub fn back_to_genesis(&mut self)
This reverses to genesis (based on current time/height)
Sourcepub fn advance_blocks(&mut self, blocks: u64)
pub fn advance_blocks(&mut self, blocks: u64)
This advances BlockInfo by given number of blocks. It does not do any callbacks, but keeps the ratio of seconds/blokc
Sourcepub fn advance_seconds(&mut self, seconds: u64)
pub fn advance_seconds(&mut self, seconds: u64)
This advances BlockInfo by given number of seconds. It does not do any callbacks, but keeps the ratio of seconds/blokc
Sourcepub fn next_block(&mut self) -> AnyResult<Option<ValidatorDiff>>
pub fn next_block(&mut self) -> AnyResult<Option<ValidatorDiff>>
next_block will call the end_blocker, increment block info 1 height and 5 seconds, and then call the begin_blocker (with no evidence) in the next block. It returns the validator diff if any.
Simple iterator when you don’t care too much about the details and just want to simulate forward motion.
Sourcepub fn with_privilege(&self, requested: Privilege) -> AnyResult<Vec<Addr>>
pub fn with_privilege(&self, requested: Privilege) -> AnyResult<Vec<Addr>>
Returns a list of all contracts that have the requested privilege
Sourcepub fn begin_block(
&mut self,
evidence: Vec<Evidence>,
) -> AnyResult<Vec<AppResponse>>
pub fn begin_block( &mut self, evidence: Vec<Evidence>, ) -> AnyResult<Vec<AppResponse>>
Make the BeginBlock sudo callback on all contracts that have registered with the BeginBlocker Privilege
Sourcepub fn end_block(
&mut self,
) -> AnyResult<(Vec<AppResponse>, Option<ValidatorDiff>)>
pub fn end_block( &mut self, ) -> AnyResult<(Vec<AppResponse>, Option<ValidatorDiff>)>
Make the EndBlock sudo callback on all contracts that have registered with the EndBlocker Privilege. Then makes the EndWithValidatorUpdate callback on any registered valset_updater.
Methods from Deref<Target = TgradeAppWrapped>§
pub fn init_modules<F, T>(&mut self, init_fn: F) -> T
pub fn read_module<F, T>(&self, query_fn: F) -> T
Sourcepub fn store_code(
&mut self,
code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>,
) -> u64
pub fn store_code( &mut self, code: Box<dyn Contract<<CustomT as Module>::ExecT, <CustomT as Module>::QueryT>>, ) -> u64
This registers contract code (like uploading wasm bytecode on a chain), so it can later be used to instantiate a contract.
Sourcepub fn contract_data(&self, address: &Addr) -> Result<ContractData, Error>
pub fn contract_data(&self, address: &Addr) -> Result<ContractData, Error>
This allows to get ContractData for specific contract
Sourcepub fn dump_wasm_raw(&self, address: &Addr) -> Vec<(Vec<u8>, Vec<u8>)>
pub fn dump_wasm_raw(&self, address: &Addr) -> Vec<(Vec<u8>, Vec<u8>)>
This gets a raw state dump of all key-values held by a given contract
pub fn set_block(&mut self, block: BlockInfo)
pub fn update_block<F>(&mut self, action: F)
Sourcepub fn block_info(&self) -> BlockInfo
pub fn block_info(&self) -> BlockInfo
Returns a copy of the current block_info
Sourcepub fn wrap(&self) -> QuerierWrapper<'_, <CustomT as Module>::QueryT>
pub fn wrap(&self) -> QuerierWrapper<'_, <CustomT as Module>::QueryT>
Simple helper so we get access to all the QuerierWrapper helpers, eg. wrap().query_wasm_smart, query_all_balances, …
Sourcepub fn execute_multi(
&mut self,
sender: Addr,
msgs: Vec<CosmosMsg<<CustomT as Module>::ExecT>>,
) -> Result<Vec<AppResponse>, Error>
pub fn execute_multi( &mut self, sender: Addr, msgs: Vec<CosmosMsg<<CustomT as Module>::ExecT>>, ) -> Result<Vec<AppResponse>, Error>
Runs multiple CosmosMsg in one atomic operation. This will create a cache before the execution, so no state changes are persisted if any of them return an error. But all writes are persisted on success.
Trait Implementations§
Source§impl Deref for TgradeApp
impl Deref for TgradeApp
Source§type Target = App<BankKeeper, MockApi, MemoryStorage, TgradeModule, WasmKeeper<TgradeMsg, TgradeQuery>>
type Target = App<BankKeeper, MockApi, MemoryStorage, TgradeModule, WasmKeeper<TgradeMsg, TgradeQuery>>
Source§impl Querier for TgradeApp
impl Querier for TgradeApp
Source§fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
Auto Trait Implementations§
impl Freeze for TgradeApp
impl !RefUnwindSafe for TgradeApp
impl !Send for TgradeApp
impl !Sync for TgradeApp
impl Unpin for TgradeApp
impl !UnwindSafe for TgradeApp
Blanket Implementations§
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more