fix fiat trades by changing base currency to xmr #7

This commit is contained in:
woodser 2021-05-04 22:09:23 -04:00
parent 69ee113dae
commit 01f183b7a7
38 changed files with 106 additions and 102 deletions

View File

@ -57,6 +57,7 @@ public class ApiTestConfig {
// Global constants
public static final String BSQ = "BSQ";
public static final String BTC = "BTC";
public static final String XMR = "XMR";
public static final String ARBITRATOR = "arbitrator";
public static final String MEDIATOR = "mediator";
public static final String REFUND_AGENT = "refundagent";

View File

@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import static bisq.apitest.config.ApiTestConfig.BSQ;
import static bisq.apitest.config.ApiTestConfig.BTC;
import static bisq.apitest.config.ApiTestConfig.XMR;
import static bisq.cli.TableFormat.formatOfferTable;
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
import static java.util.Collections.singletonList;
@ -47,7 +47,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
@Test
@Order(1)
public void testCreateAUDBTCBuyOfferUsingFixedPrice16000() {
public void testCreateAUDXMRBuyOfferUsingFixedPrice16000() {
PaymentAccount audAccount = createDummyF2FAccount(aliceClient, "AU");
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
"aud",
@ -67,7 +67,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("AUD", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
@ -80,14 +80,14 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("AUD", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
}
@Test
@Order(2)
public void testCreateUSDBTCBuyOfferUsingFixedPrice100001234() {
public void testCreateUSDXMRBuyOfferUsingFixedPrice100001234() {
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
"usd",
@ -107,7 +107,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("USD", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
@ -120,14 +120,14 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("USD", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
}
@Test
@Order(3)
public void testCreateEURBTCSellOfferUsingFixedPrice95001234() {
public void testCreateEURXMRSellOfferUsingFixedPrice95001234() {
PaymentAccount eurAccount = createDummyF2FAccount(aliceClient, "FR");
var newOffer = aliceClient.createFixedPricedOffer(SELL.name(),
"eur",
@ -147,7 +147,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("EUR", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
@ -160,7 +160,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("EUR", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
}

View File

@ -31,7 +31,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import static bisq.apitest.config.ApiTestConfig.BTC;
import static bisq.apitest.config.ApiTestConfig.XMR;
import static bisq.cli.TableFormat.formatOfferTable;
import static bisq.common.util.MathUtils.scaleDownByPowerOf10;
import static bisq.common.util.MathUtils.scaleUpByPowerOf10;
@ -54,11 +54,11 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
private static final double MKT_PRICE_MARGIN_ERROR_TOLERANCE = 0.0050; // 0.50%
private static final double MKT_PRICE_MARGIN_WARNING_TOLERANCE = 0.0001; // 0.01%
private static final String MAKER_FEE_CURRENCY_CODE = BTC;
private static final String MAKER_FEE_CURRENCY_CODE = XMR;
@Test
@Order(1)
public void testCreateUSDBTCBuyOffer5PctPriceMargin() {
public void testCreateUSDXMRBuyOffer5PctPriceMargin() {
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
double priceMarginPctInput = 5.00;
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
@ -78,7 +78,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("USD", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -90,7 +90,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("USD", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -99,7 +99,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
@Test
@Order(2)
public void testCreateNZDBTCBuyOfferMinus2PctPriceMargin() {
public void testCreateNZDXMRBuyOfferMinus2PctPriceMargin() {
PaymentAccount nzdAccount = createDummyF2FAccount(aliceClient, "NZ");
double priceMarginPctInput = -2.00;
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
@ -119,7 +119,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("NZD", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -131,7 +131,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(10_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("NZD", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -140,7 +140,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
@Test
@Order(3)
public void testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin() {
public void testCreateGBPXMRSellOfferMinus1Point5PctPriceMargin() {
PaymentAccount gbpAccount = createDummyF2FAccount(aliceClient, "GB");
double priceMarginPctInput = -1.5;
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
@ -160,7 +160,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("GBP", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -172,7 +172,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("GBP", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -181,7 +181,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
@Test
@Order(4)
public void testCreateBRLBTCSellOffer6Point55PctPriceMargin() {
public void testCreateBRLXMRSellOffer6Point55PctPriceMargin() {
PaymentAccount brlAccount = createDummyF2FAccount(aliceClient, "BR");
double priceMarginPctInput = 6.55;
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
@ -201,7 +201,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("BRL", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
@ -213,7 +213,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
assertEquals(5_000_000, newOffer.getMinAmount());
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
assertEquals(BTC, newOffer.getBaseCurrencyCode());
assertEquals(XMR, newOffer.getBaseCurrencyCode());
assertEquals("BRL", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

View File

@ -58,19 +58,19 @@ public class OfferTest extends AbstractOfferTest {
@Order(3)
public void testCreateOfferUsingFixedPrice() {
CreateOfferUsingFixedPriceTest test = new CreateOfferUsingFixedPriceTest();
test.testCreateAUDBTCBuyOfferUsingFixedPrice16000();
test.testCreateUSDBTCBuyOfferUsingFixedPrice100001234();
test.testCreateEURBTCSellOfferUsingFixedPrice95001234();
test.testCreateAUDXMRBuyOfferUsingFixedPrice16000();
test.testCreateUSDXMRBuyOfferUsingFixedPrice100001234();
test.testCreateEURXMRSellOfferUsingFixedPrice95001234();
}
@Test
@Order(4)
public void testCreateOfferUsingMarketPriceMargin() {
CreateOfferUsingMarketPriceMarginTest test = new CreateOfferUsingMarketPriceMarginTest();
test.testCreateUSDBTCBuyOffer5PctPriceMargin();
test.testCreateNZDBTCBuyOfferMinus2PctPriceMargin();
test.testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin();
test.testCreateBRLBTCSellOffer6Point55PctPriceMargin();
test.testCreateUSDXMRBuyOffer5PctPriceMargin();
test.testCreateNZDXMRBuyOfferMinus2PctPriceMargin();
test.testCreateGBPXMRSellOfferMinus1Point5PctPriceMargin();
test.testCreateBRLXMRSellOffer6Point55PctPriceMargin();
}
@Test

View File

@ -532,9 +532,9 @@ public class CurrencyUtil {
.filter(cryptoCurrency -> cryptoCurrency.getCode().equals(currencyCode))
.findAny();
String btcOrRemovedAsset = "BTC".equals(currencyCode) ? "Bitcoin" :
String xmrOrRemovedAsset = "XMR".equals(currencyCode) ? "Monero" :
removedCryptoCurrency.isPresent() ? removedCryptoCurrency.get().getName() : Res.get("shared.na");
return getCryptoCurrency(currencyCode).map(TradeCurrency::getName).orElse(btcOrRemovedAsset);
return getCryptoCurrency(currencyCode).map(TradeCurrency::getName).orElse(xmrOrRemovedAsset);
}
try {
return Currency.getInstance(currencyCode).getDisplayName();

View File

@ -433,7 +433,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
return currencyCode;
}
currencyCode = offerPayload.getBaseCurrencyCode().equals("BTC") ?
currencyCode = offerPayload.getBaseCurrencyCode().equals("XMR") ?
offerPayload.getCounterCurrencyCode() :
offerPayload.getBaseCurrencyCode();
return currencyCode;

View File

@ -384,12 +384,12 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
}
// In the offer we support base and counter currency
// Fiat offers have base currency BTC and counterCurrency Fiat
// Altcoins have base currency Altcoin and counterCurrency BTC
// Fiat offers have base currency XMR and counterCurrency Fiat
// Altcoins have base currency Altcoin and counterCurrency XMR
// 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 getBaseCurrencyCode().equals("BTC") ? getCounterCurrencyCode() : getBaseCurrencyCode();
return getBaseCurrencyCode().equals("XMR") ? getCounterCurrencyCode() : getBaseCurrencyCode();
}
@Override

View File

@ -307,7 +307,7 @@ public final class TradeStatistics2 implements ProcessOncePersistableNetworkPayl
}
public String getCurrencyCode() {
return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
return baseCurrency.equals("XMR") ? counterCurrency : baseCurrency;
}
public Coin getTradeAmount() {

View File

@ -284,7 +284,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
setCryptoCurrencies(CurrencyUtil.getMainCryptoCurrencies());
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) {
if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) { // TODO (woodser): change to XMR when --baseCurrencyNetwork=XMR_REGTEST supported
setBlockChainExplorerMainNet(BTC_MAIN_NET_EXPLORERS.get(0));
setBlockChainExplorerTestNet(BTC_TEST_NET_EXPLORERS.get(0));
} else {

View File

@ -15,8 +15,8 @@ public class BankUtilTest {
public void setup() {
Locale.setDefault(new Locale("en", "US"));
GlobalSettings.setLocale(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -45,8 +45,8 @@ public class CurrencyUtilTest {
public void setup() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -46,7 +46,7 @@ public class OfferMaker {
lookup.valueOf(useMarketBasedPrice, false),
lookup.valueOf(amount, 100000L),
lookup.valueOf(minAmount, 100000L),
lookup.valueOf(baseCurrencyCode, "BTC"),
lookup.valueOf(baseCurrencyCode, "XMR"),
lookup.valueOf(counterCurrencyCode, "USD"),
null,
null,

View File

@ -45,6 +45,9 @@ public class AltCoinAddressValidatorTest {
validator.setCurrencyCode("BTC");
assertTrue(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
validator.setCurrencyCode("XMR");
assertTrue(validator.validate("4AuUM6PedofLWKfRCX1fP3SoNZUzq6FSAbpevHRR6tVuMpZc3HznVeudmNGkEB75apjE7WKVgZZh1YvPVxZoHFN88NCdmWw").isValid);
validator.setCurrencyCode("LTC");
assertTrue(validator.validate("Lg3PX8wRWmApFCoCMAsPF5P9dPHYQHEWKW").isValid);

View File

@ -54,8 +54,8 @@ public class PreferencesTest {
final Locale en_US = new Locale("en", "US");
Locale.setDefault(en_US);
GlobalSettings.setLocale(en_US);
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
persistenceManager = mock(PersistenceManager.class);
Config config = new Config();

View File

@ -31,8 +31,8 @@ public class FormattingUtilsTest {
@Before
public void setUp() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -37,8 +37,8 @@ public class RegexValidatorTest {
public void setup() {
Locale.setDefault(new Locale("en", "US"));
GlobalSettings.setLocale(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -251,7 +251,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
try {
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
double availableBalance = Double.parseDouble(
model.getAvailableBalance().getValue().replace("BTC", ""));
model.getAvailableBalance().getValue().replace("XMR", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
tooltipText += "\n" + currencyFormat.format(availableBalance * marketPrice) +
" " + preferredTradeCurrency;
@ -276,7 +276,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
try {
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
double reservedBalance = Double.parseDouble(
model.getReservedBalance().getValue().replace("BTC", ""));
model.getReservedBalance().getValue().replace("XMR", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
tooltipText += "\n" + currencyFormat.format(reservedBalance * marketPrice) +
" " + preferredTradeCurrency;
@ -301,7 +301,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
try {
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
double lockedBalance = Double.parseDouble(
model.getLockedBalance().getValue().replace("BTC", ""));
model.getLockedBalance().getValue().replace("XMR", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
tooltipText += "\n" + currencyFormat.format(lockedBalance * marketPrice) +
" " + preferredTradeCurrency;

View File

@ -1464,7 +1464,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
tradeFeeInBtcToggle.setText("BTC");
tradeFeeInBtcToggle.setText("BTC"); // TODO (woodser): update to XMR
tradeFeeInBtcToggle.setVisible(false);
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

View File

@ -1201,7 +1201,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
tradeFeeInBtcToggle.setText("BTC");
tradeFeeInBtcToggle.setText("BTC"); // TODO (woodser): update to XMR
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();

View File

@ -72,15 +72,15 @@ public class AboutView extends ActivatableView<GridPane, Void> {
hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.contribute"), "https://bisq.network/contribute");
GridPane.setColumnSpan(hyperlinkWithIcon, 2);
boolean isBtc = Res.getBaseCurrencyCode().equals("BTC");
addTitledGroupBg(root, ++gridRow, isBtc ? 3 : 2, Res.get("setting.about.providers"), Layout.GROUP_DISTANCE);
boolean isXmr = Res.getBaseCurrencyCode().equals("XMR");
addTitledGroupBg(root, ++gridRow, isXmr ? 3 : 2, Res.get("setting.about.providers"), Layout.GROUP_DISTANCE);
label = addLabel(root, gridRow, Res.get(isBtc ? "setting.about.apisWithFee" : "setting.about.apis"), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
label = addLabel(root, gridRow, Res.get(isXmr ? "setting.about.apisWithFee" : "setting.about.apis"), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
label.setWrapText(true);
GridPane.setHalignment(label, HPos.LEFT);
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.pricesProvided"),
"Bisq Price Index (https://bisq.wiki/Bisq_Price_Index)");
if (isBtc)
if (isXmr)
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.feeEstimation.label"), "mempool.space (https://mempool.space)");
addTitledGroupBg(root, ++gridRow, 2, Res.get("setting.about.versionDetails"), Layout.GROUP_DISTANCE);

View File

@ -51,8 +51,8 @@ public class ComponentsDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
GlobalSettings.setDefaultTradeCurrency(btc);
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
GlobalSettings.setDefaultTradeCurrency(xmr);
GlobalSettings.setLocale(Locale.US);
Res.setup();
@ -85,9 +85,9 @@ public class ComponentsDemo extends Application {
final Button buttonEnabled = FormBuilder.addButton(gridPane, rowIndex++, "Hello World");
buttonEnabled.setOnMouseClicked((click) -> {
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 BTC"), "CLOSE", 3000, true, b -> bar.close()));
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 XMR"), "CLOSE", 3000, true, b -> bar.close()));
// new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline"))
// .message(Res.get("popup.roundedFiatValues.msg", "BTC"))
// .message(Res.get("popup.roundedFiatValues.msg", "XMR"))
// .show();
// new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
// .notification(Res.get("notification.tradeCompleted.msg"))

View File

@ -40,7 +40,7 @@ public class MarketsPrintTool {
final Collection<FiatCurrency> allSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies();
final Stream<MarketCurrency> fiatStream = allSortedFiatCurrencies.stream()
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BSQ"))
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC"))
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC")) // TODO (woodser): update to XMR
.map(e -> new MarketCurrency("btc_" + e.getCode().toLowerCase(), e.getName(), e.getCode()))
.distinct();

View File

@ -35,8 +35,8 @@ public class DaoStateBlockListItemTest {
@Before
public void setup() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -70,7 +70,7 @@ public class TradesChartsViewModelTest {
false,
0,
0,
"BTC",
"XMR",
"EUR",
null,
null,

View File

@ -43,8 +43,8 @@ public class CreateOfferDataModelTest {
@Before
public void setUp() {
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
GlobalSettings.setDefaultTradeCurrency(btc);
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
GlobalSettings.setDefaultTradeCurrency(xmr);
Res.setup();
XmrAddressEntry addressEntry = mock(XmrAddressEntry.class);

View File

@ -78,7 +78,7 @@ public class CreateOfferViewModelTest {
@Before
public void setUp() {
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
final CryptoCurrency btc = new CryptoCurrency("XMR", "monero");
GlobalSettings.setDefaultTradeCurrency(btc);
Res.setup();
@ -135,7 +135,7 @@ public class CreateOfferViewModelTest {
coinFormatter,
tradeStats,
null);
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("XMR", "monero"));
dataModel.activate();
model = new CreateOfferViewModel(dataModel,

View File

@ -51,7 +51,7 @@ public class OfferBookListItemMaker {
with(OfferMaker.direction, lookup.valueOf(direction, OfferPayload.Direction.BUY)),
with(OfferMaker.useMarketBasedPrice, lookup.valueOf(useMarketBasedPrice, false)),
with(OfferMaker.marketPriceMargin, lookup.valueOf(marketPriceMargin, 0.0)),
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "BTC")),
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "XMR")),
with(OfferMaker.counterCurrencyCode, lookup.valueOf(counterCurrencyCode, "USD")),
with(OfferMaker.id, lookup.valueOf(id, "1234"))
)));

View File

@ -594,7 +594,7 @@ public class OfferBookViewModelTest {
false,
0,
0,
"BTC",
"XMR",
tradeCurrencyCode,
null,
null,

View File

@ -61,8 +61,8 @@ public class EditOfferDataModelTest {
@Before
public void setUp() {
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
GlobalSettings.setDefaultTradeCurrency(btc);
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
GlobalSettings.setDefaultTradeCurrency(xmr);
Res.setup();
FeeService feeService = mock(FeeService.class);

View File

@ -25,7 +25,7 @@ import com.natpryce.makeiteasy.Instantiator;
import com.natpryce.makeiteasy.Maker;
import com.natpryce.makeiteasy.Property;
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
import static com.natpryce.makeiteasy.MakeItEasy.a;
import static com.natpryce.makeiteasy.MakeItEasy.with;
@ -36,7 +36,7 @@ public class CurrencyListItemMakers {
public static final Property<CurrencyListItem, Integer> numberOfTrades = new Property<>();
public static final Instantiator<CurrencyListItem> CurrencyListItem = lookup ->
new CurrencyListItem(lookup.valueOf(tradeCurrency, bitcoin), lookup.valueOf(numberOfTrades, 0));
new CurrencyListItem(lookup.valueOf(tradeCurrency, monero), lookup.valueOf(numberOfTrades, 0));
public static final Maker<CurrencyListItem> bitcoinItem = a(CurrencyListItem);
public static final Maker<CurrencyListItem> euroItem = a(CurrencyListItem, with(tradeCurrency, euro));

View File

@ -50,7 +50,7 @@ public class OfferMaker {
lookup.valueOf(useMarketBasedPrice, false),
lookup.valueOf(amount, 100000L),
lookup.valueOf(minAmount, 100000L),
lookup.valueOf(baseCurrencyCode, "BTC"),
lookup.valueOf(baseCurrencyCode, "XMR"),
lookup.valueOf(counterCurrencyCode, "USD"),
null,
null,

View File

@ -34,12 +34,12 @@ public class TradeCurrencyMakers {
public static final Property<TradeCurrency, String> currencyName = new Property<>();
public static final Instantiator<bisq.core.locale.CryptoCurrency> CryptoCurrency = lookup ->
new CryptoCurrency(lookup.valueOf(currencyCode, "BTC"), lookup.valueOf(currencyName, "Bitcoin"));
new CryptoCurrency(lookup.valueOf(currencyCode, "XMR"), lookup.valueOf(currencyName, "Monero"));
public static final Instantiator<bisq.core.locale.FiatCurrency> FiatCurrency = lookup ->
new FiatCurrency(lookup.valueOf(currencyCode, "EUR"));
public static final CryptoCurrency bitcoin = make(a(CryptoCurrency));
public static final CryptoCurrency monero = make(a(CryptoCurrency));
public static final FiatCurrency euro = make(a(FiatCurrency));
public static final FiatCurrency usd = make(a(FiatCurrency).but(with(currencyCode, "USD")));
}

View File

@ -32,8 +32,8 @@ public class DisplayUtilsTest {
@Before
public void setUp() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test
@ -57,9 +57,9 @@ public class DisplayUtilsTest {
@Test
public void testFormatSameVolume() {
Offer offer = mock(Offer.class);
Volume btc = Volume.parse("0.10", "BTC");
when(offer.getMinVolume()).thenReturn(btc);
when(offer.getVolume()).thenReturn(btc);
Volume xmr = Volume.parse("0.10", "XMR");
when(offer.getMinVolume()).thenReturn(xmr);
when(offer.getVolume()).thenReturn(xmr);
assertEquals("0.10000000", DisplayUtils.formatVolume(offer.getVolume()));
}
@ -67,11 +67,11 @@ public class DisplayUtilsTest {
@Test
public void testFormatDifferentVolume() {
Offer offer = mock(Offer.class);
Volume btcMin = Volume.parse("0.10", "BTC");
Volume btcMax = Volume.parse("0.25", "BTC");
Volume xmrMin = Volume.parse("0.10", "XMR");
Volume xmrMax = Volume.parse("0.25", "XMR");
when(offer.isRange()).thenReturn(true);
when(offer.getMinVolume()).thenReturn(btcMin);
when(offer.getVolume()).thenReturn(btcMax);
when(offer.getMinVolume()).thenReturn(xmrMin);
when(offer.getVolume()).thenReturn(xmrMax);
assertEquals("0.10000000 - 0.25000000", DisplayUtils.formatVolume(offer, false, 0));
}

View File

@ -39,7 +39,7 @@ import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
import static com.natpryce.makeiteasy.MakeItEasy.a;
import static com.natpryce.makeiteasy.MakeItEasy.make;
@ -57,14 +57,14 @@ public class GUIUtilTest {
public void setup() {
Locale.setDefault(new Locale("en", "US"));
GlobalSettings.setLocale(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test
public void testTradeCurrencyConverter() {
Map<String, Integer> offerCounts = new HashMap<>() {{
put("BTC", 11);
put("XMR", 11);
put("EUR", 10);
}};
StringConverter<TradeCurrency> tradeCurrencyConverter = GUIUtil.getTradeCurrencyConverter(
@ -73,7 +73,7 @@ public class GUIUtilTest {
offerCounts
);
assertEquals("Bitcoin (BTC) - 11 offers", tradeCurrencyConverter.toString(bitcoin));
assertEquals("Monero (XMR) - 11 offers", tradeCurrencyConverter.toString(monero));
assertEquals("★ Euro (EUR) - 10 offers", tradeCurrencyConverter.toString(euro));
}

View File

@ -44,8 +44,8 @@ public class ImmutableCoinFormatterTest {
@Before
public void setUp() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -14,8 +14,8 @@ public class AccountNrValidatorTest {
@Before
public void setup() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -15,8 +15,8 @@ public class BranchIdValidatorTest {
@Before
public void setup() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test

View File

@ -15,8 +15,8 @@ public class NationalAccountIdValidatorTest {
@Before
public void setup() {
Locale.setDefault(new Locale("en", "US"));
Res.setBaseCurrencyCode("BTC");
Res.setBaseCurrencyName("Bitcoin");
Res.setBaseCurrencyCode("XMR");
Res.setBaseCurrencyName("Monero");
}
@Test