pub(crate) fn deposit_passive_strategy(
    deps: &Deps,
    deposit_amount: Uint128,
    bluna_address: Addr,
    astro_lp_address: &Addr,
    response: Response,
) -> VaultResult<Response> {
    // split luna into half so half goes to purchase bLuna, remaining half is used as liquidity
    let luna_asset = astroport::asset::Asset {
        amount: deposit_amount.checked_div(Uint128::from(2_u8))?,
        info: astroport::asset::AssetInfo::NativeToken {
            denom: LUNA_DENOM.to_string(),
        },
    };

    // simulate the luna swap so we know the bluna return amount when we later provide liquidity
    let bluna_return: astroport::pair::SimulationResponse = deps.querier.query_wasm_smart(
        astro_lp_address,
        &astroport::pair::QueryMsg::Simulation {
            offer_asset: luna_asset.clone(),
        },
    )?;

    let bluna_asset = astroport::asset::Asset {
        amount: bluna_return.return_amount,
        info: astroport::asset::AssetInfo::Token {
            contract_addr: bluna_address,
        },
    };

    let bluna_purchase_msg = CosmosMsg::Wasm(WasmMsg::Execute {
        contract_addr: astro_lp_address.to_string(),
        msg: to_binary(&astroport::pair::ExecuteMsg::Swap {
            offer_asset: luna_asset.clone(),
            belief_price: None,
            max_spread: None,
            to: None,
        })?,
        funds: vec![],
    });

    let deposit_msg = CosmosMsg::Wasm(WasmMsg::Execute {
        contract_addr: astro_lp_address.to_string(),
        msg: to_binary(&astroport::pair::ExecuteMsg::ProvideLiquidity {
            assets: [luna_asset, bluna_asset],
            slippage_tolerance: None,
            auto_stake: None,
            receiver: None,
        })?,
        funds: vec![],
    });

    let response = response.add_messages(vec![
        bluna_purchase_msg, // 1. purchase bluna
        deposit_msg,        // 2. deposit bLuna/Luna to the LP as liquidity
    ]);

    Ok(response)
}
// Deposits Luna into the passive strategy (Astroport) -> luna-bluna LP
Deposits Luna into the passive strategy (Astroport) -> luna-bluna LP
Deposits Luna into the passive strategy ( Astroport ) - > luna - bluna LP
pub(crate) fn deposit_passive_strategy(
    deps: &Deps,
    deposit_amount: Uint128,
    bluna_address: Addr,
    astro_lp_address: &Addr,
    response: Response,
) -> VaultResult<Response> {
    // split luna into half so half goes to purchase bLuna, remaining half is used as liquidity
    let luna_asset = astroport::asset::Asset {
        amount: deposit_amount.checked_div(Uint128::from(2_u8))?,
        info: astroport::asset::AssetInfo::NativeToken {
            denom: LUNA_DENOM.to_string(),
        },
    };
    // simulate the luna swap so we know the bluna return amount when we later provide liquidity
    let bluna_return: astroport::pair::SimulationResponse = deps.querier.query_wasm_smart(
        astro_lp_address,
        &astroport::pair::QueryMsg::Simulation {
            offer_asset: luna_asset.clone(),
        },
    )?;
    let bluna_asset = astroport::asset::Asset {
        amount: bluna_return.return_amount,
        info: astroport::asset::AssetInfo::Token {
            contract_addr: bluna_address,
        },
    };
    let bluna_purchase_msg = CosmosMsg::Wasm(WasmMsg::Execute {
        contract_addr: astro_lp_address.to_string(),
        msg: to_binary(&astroport::pair::ExecuteMsg::Swap {
            offer_asset: luna_asset.clone(),
            belief_price: None,
            max_spread: None,
            to: None,
        })?,
        funds: vec![],
    });
    let deposit_msg = CosmosMsg::Wasm(WasmMsg::Execute {
        contract_addr: astro_lp_address.to_string(),
        msg: to_binary(&astroport::pair::ExecuteMsg::ProvideLiquidity {
            assets: [luna_asset, bluna_asset],
            slippage_tolerance: None,
            auto_stake: None,
            receiver: None,
        })?,
        funds: vec![],
    });
    let response = response.add_messages(vec![
        bluna_purchase_msg, // 1. purchase bluna
        deposit_msg,        // 2. deposit bLuna/Luna to the LP as liquidity
    ]);
    Ok(response)
}
pub ( crate ) fn deposit_passive_strategy ( deps : & Deps , deposit_amount : Uint128 , bluna_address : Addr , astro_lp_address : & Addr , response : Response , ) -> VaultResult < Response > { // split luna into half so half goes to purchase bLuna, remaining half is used as liquidity let luna_asset = astroport :: asset :: Asset { amount : deposit_amount . checked_div ( Uint128 :: from ( 2_u8 ) ) ? , info : astroport :: asset :: AssetInfo :: NativeToken { denom : LUNA_DENOM . to_string ( ) , } , } ; // simulate the luna swap so we know the bluna return amount when we later provide liquidity let bluna_return : astroport :: pair :: SimulationResponse = deps . querier . query_wasm_smart ( astro_lp_address , & astroport :: pair :: QueryMsg :: Simulation { offer_asset : luna_asset . clone ( ) , } , ) ? ; let bluna_asset = astroport :: asset :: Asset { amount : bluna_return . return_amount , info : astroport :: asset :: AssetInfo :: Token { contract_addr : bluna_address , } , } ; let bluna_purchase_msg = CosmosMsg :: Wasm ( WasmMsg :: Execute { contract_addr : astro_lp_address . to_string ( ) , msg : to_binary ( & astroport :: pair :: ExecuteMsg :: Swap { offer_asset : luna_asset . clone ( ) , belief_price : None , max_spread : None , to : None , } ) ? , funds : vec ! [ ] , } ) ; let deposit_msg = CosmosMsg :: Wasm ( WasmMsg :: Execute { contract_addr : astro_lp_address . to_string ( ) , msg : to_binary ( & astroport :: pair :: ExecuteMsg :: ProvideLiquidity { assets : [ luna_asset , bluna_asset ] , slippage_tolerance : None , auto_stake : None , receiver : None , } ) ? , funds : vec ! [ ] , } ) ; let response = response . add_messages ( vec ! [ bluna_purchase_msg // 1. purchase bluna deposit_msg // 2. deposit bLuna/Luna to the LP as liquidity ] ) ; Ok ( response ) }
Deposits Luna into the passive strategy (Astroport) -> luna-bluna LP
Deposits Luna into the passive strategy ( Astroport ) - > luna - bluna LP
deps
&Deps
deposit_amount
Uint128
bluna_address
Addr
astro_lp_address
&Addr
response
Response
deps
&Deps
deposit_amount
Uint128
bluna_address
Addr
astro_lp_address
&Addr
response
Response