pub struct WasmKeeper<ExecC: 'static, QueryC: CustomQuery + 'static> {
pub code_base: RefCell<HashMap<usize, WasmContract>>,
pub rust_codes: HashMap<usize, *mut dyn Contract<ExecC, QueryC>>,
pub code_data: HashMap<usize, CodeData>,
/* private fields */
}Fields§
§code_base: RefCell<HashMap<usize, WasmContract>>Contract codes that stand for wasm code in real-life blockchain.
rust_codes: HashMap<usize, *mut dyn Contract<ExecC, QueryC>>Contract codes that stand for rust code living in the current instance We also associate the queries to them to make sure we are able to use them with the vm instance
code_data: HashMap<usize, CodeData>Code data with code base identifier and additional attributes.
Implementations§
Source§impl<ExecC, QueryC> WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
impl<ExecC, QueryC> WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
Source§impl<ExecC, QueryC> WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
impl<ExecC, QueryC> WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
pub fn new() -> Self
pub fn new_with_custom_address_generator( address_generator: impl AddressGenerator + 'static, ) -> Self
WasmKeeper::new().with_address_generator instead; will be removed in version 1.0.0pub fn with_remote(self, remote: RemoteChannel) -> Self
pub fn with_address_generator( self, address_generator: impl AddressGenerator + 'static, ) -> Self
pub fn with_checksum_generator( self, checksum_generator: impl ChecksumGenerator + 'static, ) -> Self
Sourcepub fn query_smart(
&self,
address: Addr,
api: &dyn Api,
storage: &dyn Storage,
querier: &dyn Querier,
block: &BlockInfo,
msg: Vec<u8>,
querier_storage: QuerierStorage,
) -> AnyResult<Binary>
pub fn query_smart( &self, address: Addr, api: &dyn Api, storage: &dyn Storage, querier: &dyn Querier, block: &BlockInfo, msg: Vec<u8>, querier_storage: QuerierStorage, ) -> AnyResult<Binary>
Executes the contract’s query entry-point.
pub fn query_raw( &self, address: Addr, storage: &dyn Storage, key: &[u8], ) -> Binary
Sourcepub fn register_contract(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
code_id: u64,
creator: Addr,
admin: impl Into<Option<Addr>>,
_label: String,
_created: u64,
salt: impl Into<Option<Binary>>,
) -> AnyResult<Addr>
pub fn register_contract( &self, api: &dyn Api, storage: &mut dyn Storage, code_id: u64, creator: Addr, admin: impl Into<Option<Addr>>, _label: String, _created: u64, salt: impl Into<Option<Binary>>, ) -> AnyResult<Addr>
Creates a contract address and empty storage instance. Returns the new contract address.
You have to call init after this to set up the contract properly. These two steps are separated to have cleaner return values.
pub fn call_execute( &self, api: &dyn Api, storage: &mut dyn Storage, address: Addr, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, info: MessageInfo, msg: Vec<u8>, querier_storage: QuerierStorage, ) -> AnyResult<Response<ExecC>>
pub fn call_instantiate( &self, address: Addr, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, info: MessageInfo, msg: Vec<u8>, querier_storage: QuerierStorage, ) -> AnyResult<Response<ExecC>>
pub fn call_reply( &self, address: Addr, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, reply: Reply, ) -> AnyResult<Response<ExecC>>
pub fn call_sudo( &self, address: Addr, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: Vec<u8>, querier_storage: QuerierStorage, ) -> AnyResult<Response<ExecC>>
pub fn call_migrate( &self, address: Addr, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: Vec<u8>, querier_storage: QuerierStorage, ) -> AnyResult<Response<ExecC>>
pub fn save_contract( &self, storage: &mut dyn Storage, address: &Addr, contract: &ContractData, ) -> AnyResult<()>
Trait Implementations§
Source§impl<ExecC, QueryC: CustomQuery> AllWasmQuerier for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC: CustomQuery> AllWasmQuerier for WasmKeeper<ExecC, QueryC>
Source§impl<ExecC, QueryC: CustomQuery> Default for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC: CustomQuery> Default for WasmKeeper<ExecC, QueryC>
Source§fn default() -> WasmKeeper<ExecC, QueryC>
fn default() -> WasmKeeper<ExecC, QueryC>
Source§impl<ExecC, QueryC> Wasm<ExecC, QueryC> for WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
impl<ExecC, QueryC> Wasm<ExecC, QueryC> for WasmKeeper<ExecC, QueryC>where
ExecC: CustomMsg + DeserializeOwned + 'static,
QueryC: CustomQuery + DeserializeOwned + 'static,
Source§fn store_wasm_code(&mut self, creator: Addr, code: Vec<u8>) -> u64
fn store_wasm_code(&mut self, creator: Addr, code: Vec<u8>) -> u64
Stores the contract’s code in the in-memory lookup table. Returns an identifier of the stored contract code.
Source§fn store_code(
&mut self,
creator: Addr,
code: Box<dyn Contract<ExecC, QueryC>>,
) -> u64
fn store_code( &mut self, creator: Addr, code: Box<dyn Contract<ExecC, QueryC>>, ) -> u64
Stores the contract’s code in the in-memory lookup table. Returns an identifier of the stored contract code.
Source§fn contract_data(
&self,
storage: &dyn Storage,
address: &Addr,
) -> AnyResult<ContractData>
fn contract_data( &self, storage: &dyn Storage, address: &Addr, ) -> AnyResult<ContractData>
Returns ContractData for the contract with specified address.
Source§fn dump_wasm_raw(&self, storage: &dyn Storage, address: &Addr) -> Vec<Record> ⓘ
fn dump_wasm_raw(&self, storage: &dyn Storage, address: &Addr) -> Vec<Record> ⓘ
Returns a raw state dump of all key-values held by a contract with specified address.
Source§fn query(
&self,
api: &dyn Api,
storage: &dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
querier: &dyn Querier,
block: &BlockInfo,
request: WasmQuery,
) -> AnyResult<Binary>
fn query( &self, api: &dyn Api, storage: &dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, querier: &dyn Querier, block: &BlockInfo, request: WasmQuery, ) -> AnyResult<Binary>
Auto Trait Implementations§
impl<ExecC, QueryC> !Freeze for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC> !RefUnwindSafe for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC> !Send for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC> !Sync for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC> Unpin for WasmKeeper<ExecC, QueryC>
impl<ExecC, QueryC> !UnwindSafe for WasmKeeper<ExecC, QueryC>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request