Skip to content

Commit

Permalink
This commit fixes the evaluation of whether a trade should incur a fee.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zathras-crypto committed Nov 8, 2016
1 parent cacd1b2 commit b856b29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/omnicore/mdex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b856b29

Please sign in to comment.