Skip to content

Commit

Permalink
change minimum trading volume for evm and tendermint to be the smalle…
Browse files Browse the repository at this point in the history
…st possible amount of the coin
  • Loading branch information
shamardy committed Sep 28, 2023
1 parent b0cb4aa commit 7ebec34
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2131,11 +2131,13 @@ impl MarketCoinOps for EthCoin {
}
}

#[inline]
fn min_tx_amount(&self) -> BigDecimal { BigDecimal::from(0) }

#[inline]
fn min_trading_vol(&self) -> MmNumber {
let pow = self.decimals / 3;
MmNumber::from(1) / MmNumber::from(10u64.pow(pow as u32))
let pow = self.decimals as u32;
MmNumber::from(1) / MmNumber::from(10u64.pow(pow))
}
}

Expand Down
6 changes: 4 additions & 2 deletions mm2src/coins/qrc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,11 +1270,13 @@ impl MarketCoinOps for Qrc20Coin {

fn display_priv_key(&self) -> Result<String, String> { utxo_common::display_priv_key(&self.utxo) }

#[inline]
fn min_tx_amount(&self) -> BigDecimal { BigDecimal::from(0) }

#[inline]
fn min_trading_vol(&self) -> MmNumber {
let pow = self.utxo.decimals / 3;
MmNumber::from(1) / MmNumber::from(10u64.pow(pow as u32))
let pow = self.utxo.decimals as u32;
MmNumber::from(1) / MmNumber::from(10u64.pow(pow))
}
}

Expand Down
4 changes: 3 additions & 1 deletion mm2src/coins/tendermint/tendermint_coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2394,9 +2394,11 @@ impl MarketCoinOps for TendermintCoin {
.to_string())
}

#[inline]
fn min_tx_amount(&self) -> BigDecimal { big_decimal_from_sat(MIN_TX_SATOSHIS, self.decimals) }

fn min_trading_vol(&self) -> MmNumber { MmNumber::from("0.00777") }
#[inline]
fn min_trading_vol(&self) -> MmNumber { self.min_tx_amount().into() }
}

#[async_trait]
Expand Down
5 changes: 3 additions & 2 deletions mm2src/coins/tendermint/tendermint_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,11 @@ impl MarketCoinOps for TendermintToken {

fn display_priv_key(&self) -> Result<String, String> { self.platform_coin.display_priv_key() }

#[inline]
fn min_tx_amount(&self) -> BigDecimal { big_decimal_from_sat(MIN_TX_SATOSHIS, self.decimals) }

/// !! This function includes dummy implementation for P.O.C work
fn min_trading_vol(&self) -> MmNumber { MmNumber::from("0.00777") }
#[inline]
fn min_trading_vol(&self) -> MmNumber { self.min_tx_amount().into() }
}

#[async_trait]
Expand Down

0 comments on commit 7ebec34

Please sign in to comment.