fn unbond_bluna(deps: DepsMut, amount: Uint128) -> UnbondHandlerResult {
    let state = STATE.load(deps.storage)?;
    let contracts = [
        BLUNA_TOKEN_MEMORY_ID.to_string(),
        ANCHOR_BLUNA_HUB_ID.to_string(),
    ];
    let contract_addresses =
        query_contracts_from_mem(deps.as_ref(), &state.memory_contract, &contracts)?;

    // if the required contracts are not found in memory, return an error
    if contract_addresses.len() != 2 {
        return Err(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ));
    }

    let bluna_address = contract_addresses
        .get(BLUNA_TOKEN_MEMORY_ID)
        .ok_or(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ))?
        .clone();
    let bluna_hub_address = contract_addresses
        .get(ANCHOR_BLUNA_HUB_ID)
        .ok_or(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ))?
        .clone();

    // create message for unbonding bluna on anchor
    let bluna_unbond_msg = anchor_bluna_unbond_msg(bluna_address, bluna_hub_address, amount)?;
    Ok(Response::new()
        .add_attributes(vec![
            ("action", "unbond_bluna"),
            ("amount", &amount.to_string()),
        ])
        .add_message(bluna_unbond_msg))
}
/// Triggers the unbonding process with the received bluna on Anchor
Triggers the unbonding process with the received bluna on Anchor
Triggers the unbonding process with the received bluna on Anchor
fn unbond_bluna(deps: DepsMut, amount: Uint128) -> UnbondHandlerResult {
    let state = STATE.load(deps.storage)?;
    let contracts = [
        BLUNA_TOKEN_MEMORY_ID.to_string(),
        ANCHOR_BLUNA_HUB_ID.to_string(),
    ];
    let contract_addresses =
        query_contracts_from_mem(deps.as_ref(), &state.memory_contract, &contracts)?;
    // if the required contracts are not found in memory, return an error
    if contract_addresses.len() != 2 {
        return Err(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ));
    }
    let bluna_address = contract_addresses
        .get(BLUNA_TOKEN_MEMORY_ID)
        .ok_or(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ))?
        .clone();
    let bluna_hub_address = contract_addresses
        .get(ANCHOR_BLUNA_HUB_ID)
        .ok_or(UnbondHandlerError::MemoryError(
            MemoryError::NotFoundInMemory {},
        ))?
        .clone();
    // create message for unbonding bluna on anchor
    let bluna_unbond_msg = anchor_bluna_unbond_msg(bluna_address, bluna_hub_address, amount)?;
    Ok(Response::new()
        .add_attributes(vec![
            ("action", "unbond_bluna"),
            ("amount", &amount.to_string()),
        ])
        .add_message(bluna_unbond_msg))
}
fn unbond_bluna ( deps : DepsMut , amount : Uint128 ) -> UnbondHandlerResult { let state = STATE . load ( deps . storage ) ? ; let contracts = [ BLUNA_TOKEN_MEMORY_ID . to_string ( ) , ANCHOR_BLUNA_HUB_ID . to_string ( ) , ] ; let contract_addresses = query_contracts_from_mem ( deps . as_ref ( ) , & state . memory_contract , & contracts ) ? ; // if the required contracts are not found in memory, return an error if contract_addresses . len ( ) != 2 { return Err ( UnbondHandlerError :: MemoryError ( MemoryError :: NotFoundInMemory { } , ) ) ; } let bluna_address = contract_addresses . get ( BLUNA_TOKEN_MEMORY_ID ) . ok_or ( UnbondHandlerError :: MemoryError ( MemoryError :: NotFoundInMemory { } , ) ) ? . clone ( ) ; let bluna_hub_address = contract_addresses . get ( ANCHOR_BLUNA_HUB_ID ) . ok_or ( UnbondHandlerError :: MemoryError ( MemoryError :: NotFoundInMemory { } , ) ) ? . clone ( ) ; // create message for unbonding bluna on anchor let bluna_unbond_msg = anchor_bluna_unbond_msg ( bluna_address , bluna_hub_address , amount ) ? ; Ok ( Response :: new ( ) . add_attributes ( vec ! [ ( " " " " ) ( " " amount to_string ( ) ) ] ) . add_message ( bluna_unbond_msg ) ) }
Triggers the unbonding process with the received bluna on Anchor
Triggers the unbonding process with the received bluna on Anchor
deps
DepsMut
amount
Uint128
deps
DepsMut
amount
Uint128