pub fn receive_cw20(
    deps: DepsMut,
    _env: Env,
    msg_info: MessageInfo,
    cw20_msg: Cw20ReceiveMsg,
) -> UnbondHandlerResult {
    match from_binary(&cw20_msg.msg)? {
        Cw20HookMsg::Unbond {} => {
            let state = STATE.load(deps.storage)?;

            // only bluna token contract can execute this message
            let bluna_asset_info =
                query_asset_from_mem(deps.as_ref(), &state.memory_contract, BLUNA_TOKEN_MEMORY_ID)?;
            match bluna_asset_info {
                AssetInfo::NativeToken { .. } => {
                    return Err(UnbondHandlerError::UnsupportedToken {});
                }
                AssetInfo::Token { contract_addr } => {
                    if deps.api.addr_validate(&msg_info.sender.to_string())? != contract_addr {
                        return Err(UnbondHandlerError::UnsupportedToken {});
                    }
                }
            };

            unbond_bluna(deps, cw20_msg.amount)
        }
    }
}
/// Handler function invoked when the unbond handler contract receives
/// a transaction. This is triggered when someone wants to unbond and withdraw luna from the vault
Handler function invoked when the unbond handler contract receives
a transaction. This is triggered when someone wants to unbond and withdraw luna from the vault
Handler function invoked when the unbond handler contract receives a transaction . This is triggered when someone wants to unbond and withdraw luna from the vault
pub fn receive_cw20(
    deps: DepsMut,
    _env: Env,
    msg_info: MessageInfo,
    cw20_msg: Cw20ReceiveMsg,
) -> UnbondHandlerResult {
    match from_binary(&cw20_msg.msg)? {
        Cw20HookMsg::Unbond {} => {
            let state = STATE.load(deps.storage)?;
            // only bluna token contract can execute this message
            let bluna_asset_info =
                query_asset_from_mem(deps.as_ref(), &state.memory_contract, BLUNA_TOKEN_MEMORY_ID)?;
            match bluna_asset_info {
                AssetInfo::NativeToken { .. } => {
                    return Err(UnbondHandlerError::UnsupportedToken {});
                }
                AssetInfo::Token { contract_addr } => {
                    if deps.api.addr_validate(&msg_info.sender.to_string())? != contract_addr {
                        return Err(UnbondHandlerError::UnsupportedToken {});
                    }
                }
            };
            unbond_bluna(deps, cw20_msg.amount)
        }
    }
}
pub fn receive_cw20 ( deps : DepsMut , _env : Env , msg_info : MessageInfo , cw20_msg : Cw20ReceiveMsg , ) -> UnbondHandlerResult { match from_binary ( & cw20_msg . msg ) ? { Cw20HookMsg :: Unbond { } => { let state = STATE . load ( deps . storage ) ? ; // only bluna token contract can execute this message let bluna_asset_info = query_asset_from_mem ( deps . as_ref ( ) , & state . memory_contract , BLUNA_TOKEN_MEMORY_ID ) ? ; match bluna_asset_info { AssetInfo :: NativeToken { .. } => { return Err ( UnbondHandlerError :: UnsupportedToken { } ) ; } AssetInfo :: Token { contract_addr } => { if deps . api . addr_validate ( & msg_info . sender . to_string ( ) ) ? != contract_addr { return Err ( UnbondHandlerError :: UnsupportedToken { } ) ; } } } ; unbond_bluna ( deps , cw20_msg . amount ) } } }
Handler function invoked when the unbond handler contract receives
a transaction.
Handler function invoked when the unbond handler contract receives a transaction .
deps
DepsMut
_env
Env
msg_info
MessageInfo
cw20_msg
Cw20ReceiveMsg
deps
DepsMut
_env
Env
msg_info
MessageInfo
cw20_msg
Cw20ReceiveMsg