Struct abstract_api::state::ApiContract
source · pub struct ApiContract<Error: From<StdError> + From<ApiError> + From<AbstractSdkError> + 'static, CustomExecMsg: 'static = Empty, CustomInitMsg: 'static = Empty, CustomQueryMsg: 'static = Empty, Receive: 'static = Empty> {
pub traders: Map<'static, Addr, HashSet<Addr>>,
pub target_os: Option<Core>,
/* private fields */
}
Expand description
The state variables for our ApiContract.
Fields§
§traders: Map<'static, Addr, HashSet<Addr>>
Map ProxyAddr -> WhitelistedTraders
target_os: Option<Core>
The OS on which commands are executed. Set each time in the abstract_os::api::ExecuteMsg::Base
handler.
Implementations§
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Constructor
pub const fn new( name: &'static str, version: &'static str, metadata: Option<&'static str> ) -> Self
sourcepub const fn with_dependencies(
self,
dependencies: &'static [StaticDependency]
) -> Self
pub const fn with_dependencies( self, dependencies: &'static [StaticDependency] ) -> Self
add dependencies to the contract
pub const fn with_replies( self, reply_handlers: &'static [(u64, ReplyHandlerFn<Self, Error>)] ) -> Self
sourcepub const fn with_ibc_callbacks(
self,
callbacks: &'static [(&'static str, IbcCallbackHandlerFn<Self, Error>)]
) -> Self
pub const fn with_ibc_callbacks( self, callbacks: &'static [(&'static str, IbcCallbackHandlerFn<Self, Error>)] ) -> Self
add IBC callback handler to contract
pub const fn with_instantiate( self, instantiate_handler: InstantiateHandlerFn<Self, CustomInitMsg, Error> ) -> Self
pub const fn with_receive( self, receive_handler: ReceiveHandlerFn<Self, ReceiveMsg, Error> ) -> Self
pub const fn with_execute( self, execute_handler: ExecuteHandlerFn<Self, CustomExecMsg, Error> ) -> Self
pub const fn with_query( self, query_handler: QueryHandlerFn<Self, CustomQueryMsg, Error> ) -> Self
pub fn state(&self, store: &dyn Storage) -> StdResult<ApiState>
Trait Implementations§
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractNameService for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractNameService for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractRegistryAccess for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractRegistryAccess for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Get the version control contract
source§fn abstract_registry(&self, deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn abstract_registry(&self, deps: Deps<'_>) -> AbstractSdkResult<Addr>
Get the address of the registry.
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
type ExecuteMsg = ExecuteMsg<BaseExecuteMsg, ApiRequestMsg<CustomExecMsg>, ReceiveMsg>
source§fn execute(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::ExecuteMsg
) -> Result<Response, Error>
fn execute( self, deps: DepsMut<'_>, env: Env, info: MessageInfo, msg: Self::ExecuteMsg ) -> Result<Response, Error>
Entry point for contract execution
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, ExecMsg, InitMsg, QueryMsg, Receive> Handler for ApiContract<Error, ExecMsg, InitMsg, QueryMsg, Receive>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, ExecMsg, InitMsg, QueryMsg, Receive> Handler for ApiContract<Error, ExecMsg, InitMsg, QueryMsg, Receive>
type Error = Error
type CustomExecMsg = ExecMsg
type CustomInitMsg = InitMsg
type CustomQueryMsg = QueryMsg
type CustomMigrateMsg = Empty
type ReceiveMsg = Receive
fn contract( &self ) -> &AbstractContract<Self, Error, ExecMsg, InitMsg, QueryMsg, Empty, Receive>
fn stored_version( &self, store: &dyn Storage ) -> Result<ContractVersion, AbstractSdkError>
fn info(&self) -> (&'static str, &'static str, Option<&'static str>)
fn dependencies(&self) -> &'static [StaticDependency]
fn maybe_execute_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>>
fn execute_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
fn maybe_instantiate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>>
fn instantiate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
fn maybe_query_handler( &self ) -> Option<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>>
fn query_handler( &self ) -> Result<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>, AbstractSdkError>
fn maybe_migrate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>>
fn migrate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
fn maybe_receive_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>>
fn receive_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
fn maybe_ibc_callback_handler( &self, id: &str ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: String, _: StdAck) -> Result<Response<Empty>, Self::Error>>
fn maybe_reply_handler( &self, id: u64 ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>>
fn reply_handler( &self, id: u64 ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> IbcCallbackEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> IbcCallbackEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
source§fn handle_ibc_callback(
self,
deps: DepsMut<'_, Empty>,
env: Env,
info: MessageInfo,
msg: IbcResponseMsg
) -> Result<Response<Empty>, Self::Error>
fn handle_ibc_callback( self, deps: DepsMut<'_, Empty>, env: Env, info: MessageInfo, msg: IbcResponseMsg ) -> Result<Response<Empty>, Self::Error>
Takes request, sets destination and executes request handler
This fn is the only way to get an ApiContract instance which ensures the destination address is set correctly.
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Identification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Identification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Retrieve identifying information about the calling OS
fn proxy_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn manager_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn os_core(&self, _deps: Deps<'_>) -> AbstractSdkResult<Core>
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg, ReceiveMsg> InstantiateEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg, ReceiveMsg> InstantiateEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
source§fn instantiate(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::InstantiateMsg
) -> Result<Response, Error>
fn instantiate( self, deps: DepsMut<'_>, env: Env, info: MessageInfo, msg: Self::InstantiateMsg ) -> Result<Response, Error>
Instantiate the api
type InstantiateMsg = InstantiateMsg<BaseInstantiateMsg, CustomInitMsg>
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ModuleIdentification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ModuleIdentification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
source§impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg: ApiQueryMsg, ReceiveMsg> QueryEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg: ApiQueryMsg, ReceiveMsg> QueryEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Where we dispatch the queries for the ApiContract
These ApiQueryMsg declarations can be found in abstract_sdk::os::common_module::app_msg