Merge branch 'master' into release-candidate-0.9.0

This commit is contained in:
Manfred Karrer 2018-11-12 20:36:47 -05:00
commit b852a6b94a
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
9 changed files with 74 additions and 29 deletions

View file

@ -160,7 +160,29 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
protected abstract void configUserThread();
protected void setupEnvironment(OptionSet options) {
/*
* JOptSimple does support input parsing. However, doing only options = parser.parse(args) isn't enough to trigger the parsing.
* The parsing is done when the actual value is going to be retrieved, i.e. options.valueOf(attributename).
*
* In order to keep usability high, we work around the aforementioned characteristics by catching the exception below
* (valueOf is called somewhere in getBisqEnvironment), thus, neatly inform the user of a ill-formed parameter and stop execution.
*
* Might be changed when the project features more user parameters meant for the user.
*/
try {
bisqEnvironment = getBisqEnvironment(options);
} catch (OptionException e) {
// unfortunately, the OptionArgumentConversionException is not visible so we cannot catch only those.
// hence, workaround
if(e.getCause() != null)
// get something like "Error while parsing application parameter '--torrcFile': File [/path/to/file] does not exist"
System.err.println("Error while parsing application parameter '--" + e.options().get(0) + "': " + e.getCause().getMessage());
else
System.err.println("Error while parsing application parameter '--" + e.options().get(0));
// we only tried to load some config until now, so no graceful shutdown is required
System.exit(1);
}
}
protected void configCoreSetup(OptionSet options) {
@ -335,12 +357,12 @@ public abstract class BisqExecutable implements GracefulShutDownHandler {
.withRequiredArg();
parser.accepts(NetworkOptionKeys.TORRC_FILE,
description("An existing torrc-file to be sourced for Tor. Note that torrc-entries, which are critical to Bisqs flawless operation, cannot be overwritten.", ""))
.withRequiredArg();
// .withValuesConvertedBy(new PathConverter(PathProperties.FILE_EXISTING, PathProperties.READABLE));
.withRequiredArg()
.withValuesConvertedBy(new PathConverter(PathProperties.FILE_EXISTING, PathProperties.READABLE));
parser.accepts(NetworkOptionKeys.TORRC_OPTIONS,
description("A list of torrc-entries to amend to Bisqs torrc. Note that torrc-entries, which are critical to Bisqs flawless operation, cannot be overwritten. [torrc options line, torrc option, ...]", ""))
.withRequiredArg();
// .withValuesConvertedBy(RegexMatcher.regex("^([^\\s,]+\\s[^,]+,?\\s*)+$"));
.withRequiredArg()
.withValuesConvertedBy(RegexMatcher.regex("^([^\\s,]+\\s[^,]+,?\\s*)+$"));
//AppOptionKeys
parser.accepts(AppOptionKeys.USER_DATA_DIR_KEY,

View file

@ -17,8 +17,6 @@
package bisq.core.offer;
import bisq.core.locale.CurrencyUtil;
import bisq.network.p2p.NodeAddress;
import bisq.network.p2p.storage.payload.ExpirablePayload;
import bisq.network.p2p.storage.payload.ProtectedStoragePayload;
@ -372,7 +370,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
// The rest of the app does not support yet that concept of base currency and counter currencies
// so we map here for convenience
public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(getBaseCurrencyCode()) ? getBaseCurrencyCode() : getCounterCurrencyCode();
return getBaseCurrencyCode().equals("BTC") ? getCounterCurrencyCode() : getBaseCurrencyCode();
}
@Override

View file

@ -66,6 +66,7 @@ public class AssetTradeActivityCheck {
Map<String, Tuple2<Long, Integer>> tradeStatMap = new HashMap<>();
tradeStatisticsManager.getObservableTradeStatisticsSet().stream()
.filter(e -> !e.getBaseCurrency().equals("BTC"))
.filter(e -> CurrencyUtil.isCryptoCurrency(e.getBaseCurrency()))
.filter(e -> e.getTradeDate().getTime() > compareDate.getTime())
.forEach(e -> {

View file

@ -17,7 +17,6 @@
package bisq.core.trade.statistics;
import bisq.core.locale.CurrencyUtil;
import bisq.core.monetary.Altcoin;
import bisq.core.monetary.AltcoinExchangeRate;
import bisq.core.monetary.Price;
@ -223,7 +222,7 @@ public final class TradeStatistics implements LazyProcessedPayload, ProtectedSto
}
public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency;
return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
}
public Coin getTradeAmount() {

View file

@ -17,7 +17,6 @@
package bisq.core.trade.statistics;
import bisq.core.locale.CurrencyUtil;
import bisq.core.monetary.Altcoin;
import bisq.core.monetary.AltcoinExchangeRate;
import bisq.core.monetary.Price;
@ -248,7 +247,7 @@ public final class TradeStatistics2 implements LazyProcessedPayload, Persistable
}
public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency;
return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
}
public Coin getTradeAmount() {

View file

@ -997,11 +997,14 @@ not a {2} specialist and cannot help in such cases.
account.altcoin.popup.wallet.confirm=I understand and confirm that I know which wallet I need to use.
account.altcoin.popup.xmr.msg=If you want to trade XMR on Bisq please be sure you understand and fulfill \
the following requirements:\n\n\
For sending XMR you need to use either the official Monero GUI wallet or the Monero simple wallet with the \
store-tx-info flag enabled (default in new versions).\n\
Please be sure that you can access the tx key (use the get_tx_key command in simplewallet) as that \
would be required in case of a dispute to enable the arbitrator to verify the XMR transfer with \
the XMR checktx tool (http://xmr.llcoins.net/checktx.html).\n\
For sending XMR you need to use either the official Monero GUI wallet or Monero CLI wallet with the \
store-tx-info flag enabled (default in new versions). Please be sure you can access the tx key as \
that would be required in case of a dispute.\n\
monero-wallet-cli (use the command get_tx_key)\n\
monero-wallet-gui (go to history tab and click on the (P) button for payment proof)\n\n\
In addition to XMR checktx tool (https://xmr.llcoins.net/checktx.html) verification can also be accomplished in-wallet.\n\
monero-wallet-cli : using command (check_tx_key).\n\
monero-wallet-gui : on the Advanced > Prove/Check page.\n\
At normal block explorers the transfer is not verifiable.\n\n\
You need to provide the arbitrator the following data in case of a dispute:\n\
- The tx private key\n\
@ -1010,8 +1013,9 @@ You need to provide the arbitrator the following data in case of a dispute:\n\
If you cannot provide the above data or if you used an incompatible wallet it would result in losing the \
dispute case. The XMR sender is responsible to be able to verify the XMR transfer to the \
arbitrator in case of a dispute.\n\n\
There is no payment ID required, just the normal public address.\n\n\
If you are not sure about that process visit the Monero forum (https://forum.getmonero.org) to find more information.
There is no payment ID required, just the normal public address.\n\
If you are not sure about that process visit (https://www.getmonero.org/resources/user-guides/prove-payment.html) \
or the Monero forum (https://forum.getmonero.org) to find more information.
account.altcoin.popup.blur.msg=If you want to trade BLUR on Bisq please be sure you understand and fulfill \
the following requirements:\n\n\
To send BLUR you must use the Blur Network CLI wallet (blur-wallet-cli). After sending a transfer payment, the\n\
@ -1031,6 +1035,23 @@ Because Conceal is a privacy coin, block explorers cannot verify transfers.\n\n\
If you cannot provide the required data to the arbitrator, you will lose the dispute case.\n\
If you do not save the transaction secret key immediately after transferring CCX, it cannot be recovered later.\n\
If you do not understand these requirements, seek help at the Conceal discord (http://discord.conceal.network).
account.altcoin.popup.drgl.msg=Trading Dragonglass on Bisq requires that you understand and fulfill \
the following requirements:\n\n\
Because of the privacy Dragonglass provides a transaction is not verifyable on the public blockchain. If required you \
can prove your payment thru use of your TXN-Private-Key.\n\
The TXN-Private Key is a one-time key automatically generated for every transaction that can \
only be accessed from within your DRGL wallet.\n\
Either by DRGL-wallet GUI (inside transaction details dialog) or by the Dragonglass CLI simplewallet (using command "get_tx_key").\n\n\
DRGL version 'Oathkeeper' and higher are REQUIRED for both.\n\n\
In case of a dispute, you must provide the arbitrator the following data:\n\
- The TXN-Private key\n\
- The transaction hash\n\
- The recipient's public address\n\n\
Verification of payment can be made using the above data as inputs at \ (http://drgl.info/#check_txn).\n\n\
If you cannot provide the above data or if you used an incompatible wallet it would result in losing the \
dispute case. The Dragonglass sender is responsible to be able to verify the DRGL transfer to the \
arbitrator in case of a dispute. Use of PaymentID is not required.\n\n\
If you are unsure about any part of this process, visit Dragonglass on Discord (http://discord.drgl.info) for help.
account.altcoin.popup.ZEC.msg=When using {0} you can only use the transparent addresses (starting with t) not \
the z-addresses (private), because the arbitrator would not be able to verify the transaction with z-addresses.
account.altcoin.popup.XZC.msg=When using {0} you can only use the transparent (traceable) addresses not \

View file

@ -137,6 +137,11 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
.useIUnderstandButton()
.show();
break;
case "DRGL":
new Popup<>().information(Res.get("account.altcoin.popup.drgl.msg"))
.useIUnderstandButton()
.show();
break;
case "ZEC":
new Popup<>().information(Res.get("account.altcoin.popup.ZEC.msg", "ZEC"))
.useIUnderstandButton()

View file

@ -103,9 +103,9 @@ public class OfferBookChartViewModelTest {
model.activate();
assertEquals(7, model.maxPlacesForBuyPrice.intValue());
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 94016475L))));
assertEquals(7, model.maxPlacesForBuyPrice.intValue());
assertEquals(9, model.maxPlacesForBuyPrice.intValue()); // 9401.6475
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 101016475L))));
assertEquals(7, model.maxPlacesForBuyPrice.intValue());
assertEquals(10, model.maxPlacesForBuyPrice.intValue()); //10101.6475
}
@Test
@ -132,9 +132,9 @@ public class OfferBookChartViewModelTest {
model.activate();
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L))));
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //10.00
assertEquals(5, model.maxPlacesForBuyVolume.intValue()); //10.00
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 22128600000L))));
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //2212.86
assertEquals(7, model.maxPlacesForBuyVolume.intValue()); //2212.86
}
@Test
@ -179,11 +179,11 @@ public class OfferBookChartViewModelTest {
final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter());
model.activate();
assertEquals(7, model.maxPlacesForSellPrice.intValue());
assertEquals(7, model.maxPlacesForSellPrice.intValue()); // 10.0000 default price
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 94016475L))));
assertEquals(7, model.maxPlacesForSellPrice.intValue());
assertEquals(9, model.maxPlacesForSellPrice.intValue()); // 9401.6475
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 101016475L))));
assertEquals(7, model.maxPlacesForSellPrice.intValue());
assertEquals(10, model.maxPlacesForSellPrice.intValue()); // 10101.6475
}
@Test
@ -210,8 +210,8 @@ public class OfferBookChartViewModelTest {
model.activate();
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L))));
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //10.00
assertEquals(5, model.maxPlacesForSellVolume.intValue()); //10.00
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 22128600000L))));
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //2212.86
assertEquals(7, model.maxPlacesForSellVolume.intValue()); //2212.86
}
}

View file

@ -114,7 +114,7 @@ public class BSFormatterTest {
@Test
public void testFormatVolume() {
assertEquals("0.01", formatter.formatVolume(make(btcUsdOffer), true, 4));
assertEquals("1.00", formatter.formatVolume(make(btcUsdOffer), true, 4));
assertEquals("100.00", formatter.formatVolume(make(usdVolume)));
assertEquals("1774.62", formatter.formatVolume(make(usdVolume.but(with(volumeString, "1774.62")))));
}