Skip to content

Commit

Permalink
Add XCH market
Browse files Browse the repository at this point in the history
  • Loading branch information
jjos2372 committed May 3, 2021
1 parent a24d5aa commit ca85c44
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/btdex/core/Market.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public abstract class Market {
public static long MARKET_BSV = 0x000000009;
public static long MARKET_BNB = 0x000000010;

public static long MARKET_XCH = 0x000000060;

// TODO: fill with other cryptos here

public static long MARKET_USD = 0x000001000;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/btdex/core/Markets.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import btdex.markets.MarketETH;
import btdex.markets.MarketLTC;
import btdex.markets.MarketTRT;
import btdex.markets.MarketXCH;
import btdex.markets.MarketXMR;
import btdex.markets.MarketXLA;
import burst.kit.service.BurstNodeService;
Expand Down Expand Up @@ -39,6 +40,7 @@ public static void loadStandardMarkets(Boolean testnet, BurstNodeService NS) {
markets.add(new MarketDOGE());
markets.add(new MarketETH());
markets.add(new MarketLTC());
markets.add(new MarketXCH());
markets.add(new MarketXMR());
markets.add(new MarketXLA());
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/btdex/markets/MarketXCH.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package btdex.markets;

import java.util.HashMap;

import btdex.core.Globals;
import btdex.locale.Translation;

public class MarketXCH extends MarketCrypto {

public String getTicker() {
return "XCH";
}

@Override
public long getID() {
return MARKET_XCH;
}

@Override
public int getUCA_ID() {
// TODO: Fix this when they get an actual UCA ID
return 666666;
}

@Override
public void validate(HashMap<String, String> fields) throws Exception {
super.validate(fields);

String addr = fields.get(ADDRESS);

// TODO: add a better check when there is some documentation
if(!addr.startsWith(Globals.getInstance().isTestnet() ? "txch1" : "xch1")) {
throw new Exception(Translation.tr("mkt_invalid_address", addr, toString()));
}
}
}

0 comments on commit ca85c44

Please sign in to comment.