fn swap_cash(
        &mut self,
        trader: &Addr,
        cash: u128,
        belief_price: impl Into<Option<Decimal>>,
        max_spread: impl Into<Option<Decimal>>,
        to: impl Into<Option<Addr>>,
    ) -> Result<&mut Self> {
        self.app
            .execute_contract(
                trader.clone(),
                self.cash.clone(),
                &cw20_base::msg::ExecuteMsg::Send {
                    contract: self.pair.to_string(),
                    amount: Uint128::new(cash),
                    msg: to_binary(&Cw20HookMsg::Swap {
                        belief_price: belief_price.into(),
                        max_spread: max_spread.into(),
                        to: to.into().as_ref().map(ToString::to_string),
                    })
                    .unwrap(),
                },
                &[],
            )
            .map_err(|err| anyhow!(err))?;

        Ok(self)
    }
/// Helper swapping cash for btc on pair
///
/// Executes `Send` message on cash contract, with `Cw20HookMsg::Swap` message as hook
Helper swapping cash for btc on pair
Executes `Send` message on cash contract, with `Cw20HookMsg::Swap` message as hook
Helper swapping cash for btc on pair Executes ` Send ` message on cash contract with ` Cw20HookMsg :: Swap ` message as hook
fn swap_cash(
        &mut self,
        trader: &Addr,
        cash: u128,
        belief_price: impl Into<Option<Decimal>>,
        max_spread: impl Into<Option<Decimal>>,
        to: impl Into<Option<Addr>>,
    ) -> Result<&mut Self> {
        self.app
            .execute_contract(
                trader.clone(),
                self.cash.clone(),
                &cw20_base::msg::ExecuteMsg::Send {
                    contract: self.pair.to_string(),
                    amount: Uint128::new(cash),
                    msg: to_binary(&Cw20HookMsg::Swap {
                        belief_price: belief_price.into(),
                        max_spread: max_spread.into(),
                        to: to.into().as_ref().map(ToString::to_string),
                    })
                    .unwrap(),
                },
                &[],
            )
            .map_err(|err| anyhow!(err))?;
        Ok(self)
    }
fn swap_cash ( & mut self , trader : & Addr , cash : u128 , belief_price : impl Into < Option < Decimal > > , max_spread : impl Into < Option < Decimal > > , to : impl Into < Option < Addr > > , ) -> Result < & mut Self > { self . app . execute_contract ( trader . clone ( ) , self . cash . clone ( ) , & cw20_base :: msg :: ExecuteMsg :: Send { contract : self . pair . to_string ( ) , amount : Uint128 :: new ( cash ) , msg : to_binary ( & Cw20HookMsg :: Swap { belief_price : belief_price . into ( ) , max_spread : max_spread . into ( ) , to : to . into ( ) . as_ref ( ) . map ( ToString :: to_string ) , } ) . unwrap ( ) , } , & [ ] , ) . map_err ( | err | anyhow ! ( err ) ) ? ; Ok ( self ) }
Helper swapping cash for btc on pair
Executes `Send` message on cash contract, with `Cw20HookMsg::Swap` message as hook
Helper swapping cash for btc on pair Executes ` Send ` message on cash contract with ` Cw20HookMsg :: Swap ` message as hook
&mut self
trader
&Addr
cash
u128
belief_price
impl Into<Option<Decimal>>
max_spread
impl Into<Option<Decimal>>
to
impl Into<Option<Addr>>
&mut self
trader
&Addr
cash
u128
belief_price
impl Into<Option<Decimal>>
max_spread
impl Into<Option<Decimal>>
to
impl Into<Option<Addr>>