Skip to content

Commit

Permalink
Merge pull request #426
Browse files Browse the repository at this point in the history
1228f7d Remove devOmni bypass (zathras-crypto)
013d23f Update the fee test script. (zathras-crypto)
b856b29 This commit fixes the evaluation of whether a trade should incur a fee. (zathras-crypto)
cacd1b2 Fix RPC output for trade matches. (zathras-crypto)
  • Loading branch information
dexX7 committed Nov 13, 2016
2 parents c22c91e + 1228f7d commit 8af9eae
Show file tree
Hide file tree
Showing 3 changed files with 325 additions and 113 deletions.
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
8 changes: 5 additions & 3 deletions src/omnicore/omnicore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,8 @@ bool CMPTradeList::getMatchingTrades(const uint256& txid, uint32_t propertyId, A

std::string strAmount1 = FormatMP(prop1, amount1);
std::string strAmount2 = FormatMP(prop2, amount2);
std::string strTradingFee = FormatMP(prop1, tradingFee);
std::string strTradingFee = FormatMP(prop2, tradingFee);
std::string strAmount2PlusFee = FormatMP(prop2, amount2+tradingFee);

// populate trade object and add to the trade array, correcting for orientation of trade
Object trade;
Expand All @@ -3338,13 +3339,14 @@ bool CMPTradeList::getMatchingTrades(const uint256& txid, uint32_t propertyId, A
trade.push_back(Pair("address", address1));
trade.push_back(Pair("amountsold", strAmount1));
trade.push_back(Pair("amountreceived", strAmount2));
trade.push_back(Pair("tradingfee", strTradingFee));
totalReceived += amount2;
totalSold += amount1;
} else {
trade.push_back(Pair("address", address2));
trade.push_back(Pair("amountsold", strAmount2));
trade.push_back(Pair("amountsold", strAmount2PlusFee));
trade.push_back(Pair("amountreceived", strAmount1));
trade.push_back(Pair("tradingfee", strTradingFee));
trade.push_back(Pair("tradingfee", FormatMP(prop1, 0))); // not the liquidity taker so no fee for this participant - include attribute for standardness
totalReceived += amount1;
totalSold += amount2;
}
Expand Down
Loading

0 comments on commit 8af9eae

Please sign in to comment.