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>

Constructor

source

pub const fn new( name: &'static str, version: &'static str, metadata: Option<&'static str> ) -> Self

source

pub const fn with_dependencies( self, dependencies: &'static [StaticDependency] ) -> Self

add dependencies to the contract

source

pub const fn with_replies( self, reply_handlers: &'static [(u64, ReplyHandlerFn<Self, Error>)] ) -> Self

source

pub const fn with_ibc_callbacks( self, callbacks: &'static [(&'static str, IbcCallbackHandlerFn<Self, Error>)] ) -> Self

add IBC callback handler to contract

source

pub const fn with_instantiate( self, instantiate_handler: InstantiateHandlerFn<Self, CustomInitMsg, Error> ) -> Self

source

pub const fn with_receive( self, receive_handler: ReceiveHandlerFn<Self, ReceiveMsg, Error> ) -> Self

source

pub const fn with_execute( self, execute_handler: ExecuteHandlerFn<Self, CustomExecMsg, Error> ) -> Self

source

pub const fn with_query( self, query_handler: QueryHandlerFn<Self, CustomQueryMsg, Error> ) -> Self

source

pub fn state(&self, store: &dyn Storage) -> StdResult<ApiState>

source

pub fn target(&self) -> Result<&Addr, ApiError>

Return the address of the proxy for the OS associated with this API. Set each time in the abstract_os::api::ExecuteMsg::Base handler.

Trait Implementations§

source§

impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractNameService for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>

source§

fn ans_host(&self, deps: Deps<'_>) -> AbstractSdkResult<AnsHost>

source§

fn name_service<'a>( &'a self, deps: Deps<'a, Empty> ) -> AbstractNameServiceClient<'a, Self>

source§

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>

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>

§

type ExecuteMsg = ExecuteMsg<BaseExecuteMsg, ApiRequestMsg<CustomExecMsg>, ReceiveMsg>

source§

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>

§

type Error = Error

§

type CustomExecMsg = ExecMsg

§

type CustomInitMsg = InitMsg

§

type CustomQueryMsg = QueryMsg

§

type CustomMigrateMsg = Empty

§

type ReceiveMsg = Receive

source§

fn contract( &self ) -> &AbstractContract<Self, Error, ExecMsg, InitMsg, QueryMsg, Empty, Receive>

source§

fn stored_version( &self, store: &dyn Storage ) -> Result<ContractVersion, AbstractSdkError>

source§

fn info(&self) -> (&'static str, &'static str, Option<&'static str>)

source§

fn dependencies(&self) -> &'static [StaticDependency]

source§

fn maybe_execute_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn execute_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_instantiate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn instantiate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_query_handler( &self ) -> Option<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>>

source§

fn query_handler( &self ) -> Result<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>, AbstractSdkError>

source§

fn maybe_migrate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn migrate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_receive_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn receive_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_ibc_callback_handler( &self, id: &str ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: String, _: StdAck) -> Result<Response<Empty>, Self::Error>>

source§

fn maybe_reply_handler( &self, id: u64 ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>>

source§

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>

source§

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>

Retrieve identifying information about the calling OS

source§

fn proxy_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>

source§

fn manager_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>

source§

fn os_core(&self, _deps: Deps<'_>) -> AbstractSdkResult<Core>

source§

fn os_id(&self, deps: Deps<'_, Empty>) -> Result<u32, AbstractSdkError>

Get the OS id for the current context.
source§

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>

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>

source§

fn module_id(&self) -> &'static str

Get the module identifier.
source§

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

§

type QueryMsg = QueryMsg<BaseQueryMsg, CustomQueryMsg>

source§

fn query( &self, deps: Deps<'_>, env: Env, msg: Self::QueryMsg ) -> Result<Binary, Error>

source§

impl<Error: From<StdError> + From<ApiError> + From<AbstractSdkError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ReceiveEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>

source§

fn handle_receive( self, deps: DepsMut<'_, Empty>, env: Env, info: MessageInfo, msg: Self::ReceiveMsg ) -> Result<Response<Empty>, Self::Error>

Auto Trait Implementations§

§

impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> RefUnwindSafe for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>

§

impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Send for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>

§

impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Sync for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>

§

impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Unpin for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>

§

impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> UnwindSafe for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>

Blanket Implementations§

source§

impl<T> AbstractResponse for Twhere T: ModuleIdentification,

source§

fn tag_response( &self, response: Response<Empty>, action: impl Into<String> ) -> Response<Empty>

Respond with an abstract-specific event that contains the contract name and the action.
source§

fn custom_tag_response( &self, response: Response<Empty>, action: impl Into<String>, attributes: impl IntoIterator<Item = impl Into<Attribute>> ) -> Response<Empty>

.tag_response() with additional attributes.
source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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> Dependencies for Twhere T: Handler,

source§

impl<T> DexInterface for Twhere T: Identification + Dependencies,

source§

fn dex<'a>(&'a self, deps: Deps<'a, Empty>, dex_name: String) -> Dex<'a, Self>

Construct a new dex interface Params: Read more
source§

impl<T> Execution for Twhere T: Identification + ModuleIdentification,

source§

fn executor<'a>(&'a self, deps: Deps<'a, Empty>) -> Executor<'a, Self>

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> IbcInterface for Twhere T: Identification,

source§

fn ibc_client<'a>(&'a self, deps: Deps<'a, Empty>) -> IbcClient<'a, Self>

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> ModuleInterface for Twhere T: Identification + Dependencies,

source§

fn modules<'a>(&'a self, deps: Deps<'a, Empty>) -> Modules<'a, Self>

source§

impl<T> ModuleRegistryInterface for Twhere T: AbstractRegistryAccess,

source§

fn module_registry<'a>( &'a self, deps: Deps<'a, Empty> ) -> ModuleRegistry<'a, Self>

source§

impl<T> OsVerification for Twhere T: AbstractRegistryAccess,

source§

fn os_registry<'a>(&'a self, deps: Deps<'a, Empty>) -> OsRegistry<'a, Self>

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> TransferInterface for Twhere T: AbstractNameService + Execution,

source§

fn bank<'a>(&'a self, deps: Deps<'a, Empty>) -> Bank<'a, Self>

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.
source§

impl<T> VaultInterface for Twhere T: AbstractNameService + Identification,

source§

fn vault<'a>(&'a self, deps: Deps<'a, Empty>) -> Vault<'a, Self>