From b856b29a27b92ddd2494e82cea3260cfdd53d8bf Mon Sep 17 00:00:00 2001 From: zathras-crypto Date: Tue, 8 Nov 2016 13:05:51 +1100 Subject: [PATCH] This commit fixes the evaluation of whether a trade should incur a fee. Updates to the test script (will follow later) now check that OMNI pair trades are free. Prior to this change the results were: Testing a trade against self where the first token is OMNI * Executing the trade * Verifiying the results # Checking no fee was taken... * Checking the original trade matches to confirm trading fee was 0...PASS * Checking the new trade matches to confirm trading fee was 0...FAIL (result:1) * Checking the fee cache is empty for property 1...PASS * Checking the fee cache is empty for property 3...FAIL (result:1) * Checking the trading address didn't lose any #1 tokens after trade...PASS * Checking the trading address didn't lose any #3 tokens after trade...FAIL (result:9999999) After this change, the same test provides the following results: Testing a trade against self where the first token is OMNI * Executing the trade * Verifiying the results # Checking no fee was taken... * Checking the original trade matches to confirm trading fee was 0...PASS * Checking the new trade matches to confirm trading fee was 0...PASS * Checking the fee cache is empty for property 1...PASS * Checking the fee cache is empty for property 3...PASS * Checking the trading address didn't lose any #1 tokens after trade...PASS * Checking the trading address didn't lose any #3 tokens after trade...PASS --- src/omnicore/mdex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/omnicore/mdex.cpp b/src/omnicore/mdex.cpp index a5030ca72e8fe..7e1fc276e73b4 100644 --- a/src/omnicore/mdex.cpp +++ b/src/omnicore/mdex.cpp @@ -263,7 +263,7 @@ static MatchReturnType x_Trade(CMPMetaDEx* const pnew) // strip a 0.05% fee from non-OMNI pairs if fees are activated if (IsFeatureActivated(FEATURE_FEES, pnew->getBlock())) { - if ( (pold->getProperty() != (OMNI_PROPERTY_MSC || OMNI_PROPERTY_TMSC)) || (pold->getDesProperty() != (OMNI_PROPERTY_MSC || OMNI_PROPERTY_TMSC)) ) { + if (pold->getProperty() > OMNI_PROPERTY_TMSC && pold->getDesProperty() > OMNI_PROPERTY_TMSC) { int64_t feeDivider = 2000; // 0.05% tradingFee = buyer_amountGot / feeDivider;