pub fn encapsulate_payload(
    _deps: Deps,
    env: Env,
    response: Response,
    loan_fee: Uint128,
) -> VaultResult<Response> {
    let total_response: Response = Response::new().add_attributes(response.attributes);

    // Callback for after the loan
    let after_trade = CallbackMsg::AfterTrade { loan_fee }.to_cosmos_msg(&env.contract.address)?;

    Ok(total_response
        // Add response that:
        // 1. Withdraws funds from Passive Strategy if needed
        // 2. Sends funds to the borrower
        // 3. Calls the borrow contract through the provided callback msg
        .add_submessages(response.messages)
        // After borrower actions, deposit the received funds back into
        // Passive Strategy if applicable
        // Call profit-check to cancel the borrow if
        // no profit is made.
        .add_message(after_trade))
}
/// Helper method which encapsulates the requested funds.
/// This function prevents callers from doing unprofitable actions
/// with the vault funds and makes sure the funds are returned by
/// the borrower.
Helper method which encapsulates the requested funds.
This function prevents callers from doing unprofitable actions
with the vault funds and makes sure the funds are returned by
the borrower.
Helper method which encapsulates the requested funds . This function prevents callers from doing unprofitable actions with the vault funds and makes sure the funds are returned by the borrower .
pub fn encapsulate_payload(
    _deps: Deps,
    env: Env,
    response: Response,
    loan_fee: Uint128,
) -> VaultResult<Response> {
    let total_response: Response = Response::new().add_attributes(response.attributes);
    // Callback for after the loan
    let after_trade = CallbackMsg::AfterTrade { loan_fee }.to_cosmos_msg(&env.contract.address)?;
    Ok(total_response
        // Add response that:
        // 1. Withdraws funds from Passive Strategy if needed
        // 2. Sends funds to the borrower
        // 3. Calls the borrow contract through the provided callback msg
        .add_submessages(response.messages)
        // After borrower actions, deposit the received funds back into
        // Passive Strategy if applicable
        // Call profit-check to cancel the borrow if
        // no profit is made.
        .add_message(after_trade))
}
pub fn encapsulate_payload ( _deps : Deps , env : Env , response : Response , loan_fee : Uint128 , ) -> VaultResult < Response > { let total_response : Response = Response :: new ( ) . add_attributes ( response . attributes ) ; // Callback for after the loan let after_trade = CallbackMsg :: AfterTrade { loan_fee } . to_cosmos_msg ( & env . contract . address ) ? ; Ok ( total_response // Add response that: // 1. Withdraws funds from Passive Strategy if needed // 2. Sends funds to the borrower // 3. Calls the borrow contract through the provided callback msg . add_submessages ( response . messages ) // After borrower actions, deposit the received funds back into // Passive Strategy if applicable // Call profit-check to cancel the borrow if // no profit is made. . add_message ( after_trade ) ) }
Helper method which encapsulates the requested funds.
Helper method which encapsulates the requested funds .
_deps
Deps
env
Env
response
Response
loan_fee
Uint128
_deps
Deps
env
Env
response
Response
loan_fee
Uint128