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

        Ok(self)
    }
/// Swap cash for btc using given pair
Swap cash for btc using given pair
Swap cash for btc using given pair
pub fn swap_cash(&mut self, pair: &Addr, trader: &Addr, cash: u128) -> Result<&mut Self> {
        self.app
            .execute_contract(
                trader.clone(),
                self.cash.addr(),
                &cw20_base::msg::ExecuteMsg::Send {
                    contract: pair.to_string(),
                    amount: Uint128::new(cash),
                    msg: to_binary(&Cw20HookMsg::Swap {
                        belief_price: None,
                        max_spread: None,
                        to: None,
                    })
                    .unwrap(),
                },
                &[],
            )
            .map_err(|err| anyhow!(err))?;
        Ok(self)
    }
pub fn swap_cash ( & mut self , pair : & Addr , trader : & Addr , cash : u128 ) -> Result < & mut Self > { self . app . execute_contract ( trader . clone ( ) , self . cash . addr ( ) , & cw20_base :: msg :: ExecuteMsg :: Send { contract : pair . to_string ( ) , amount : Uint128 :: new ( cash ) , msg : to_binary ( & Cw20HookMsg :: Swap { belief_price : None , max_spread : None , to : None , } ) . unwrap ( ) , } , & [ ] , ) . map_err ( | err | anyhow ! ( err ) ) ? ; Ok ( self ) }
Swap cash for btc using given pair
Swap cash for btc using given pair
&mut self
pair
&Addr
trader
&Addr
cash
u128
&mut self
pair
&Addr
trader
&Addr
cash
u128