1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crate::{Host, HostError};
use abstract_core::objects::AccountId;
use abstract_sdk::{
    features::{AbstractNameService, AccountIdentification},
    AbstractSdkError, AbstractSdkResult,
};
use cosmwasm_std::Deps;

impl<
        Error: From<cosmwasm_std::StdError> + From<HostError> + From<abstract_sdk::AbstractSdkError>,
        CustomInitMsg,
        CustomExecMsg,
        CustomQueryMsg,
        CustomMigrateMsg,
        ReceiveMsg,
    > AbstractNameService
    for Host<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, CustomMigrateMsg, ReceiveMsg>
{
    fn ans_host(&self, deps: Deps) -> AbstractSdkResult<abstract_sdk::feature_objects::AnsHost> {
        Ok(self.base_state.load(deps.storage)?.ans_host)
    }
}

impl<
        Error: From<cosmwasm_std::StdError> + From<HostError> + From<abstract_sdk::AbstractSdkError>,
        CustomInitMsg,
        CustomExecMsg,
        CustomQueryMsg,
        CustomMigrateMsg,
        ReceiveMsg,
    > AccountIdentification
    for Host<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, CustomMigrateMsg, ReceiveMsg>
{
    fn proxy_address(&self, _deps: Deps) -> AbstractSdkResult<cosmwasm_std::Addr> {
        self.target()
            .map_err(|e| AbstractSdkError::generic_err(e.to_string()))
            .map(ToOwned::to_owned)
    }
    fn manager_address(&self, _deps: Deps) -> AbstractSdkResult<cosmwasm_std::Addr> {
        Err(AbstractSdkError::generic_err(
            "manager address not available on stateless ibc deployment",
        ))
    }

    fn account_base(
        &self,
        _deps: Deps,
    ) -> AbstractSdkResult<abstract_sdk::core::version_control::AccountBase> {
        Err(AbstractSdkError::generic_err(
            "Account base not available on stateless ibc deployment",
        ))
    }

    fn account_id(&self, _deps: Deps) -> AbstractSdkResult<AccountId> {
        Err(AbstractSdkError::generic_err(
            "account_id not available on stateless ibc deployment",
        ))
    }
}