support DAI Stablecoin (ERC20)

This commit is contained in:
woodser 2025-02-16 08:30:26 -05:00
parent 667f0c8fb5
commit 024e59a982
4 changed files with 9 additions and 6 deletions

View File

@ -21,7 +21,7 @@
* {@link haveno.asset.Token} and {@link haveno.asset.Erc20Token}, as well as concrete
* implementations of each, such as {@link haveno.asset.coins.Bitcoin} itself, cryptos like
* {@link haveno.asset.coins.Litecoin} and {@link haveno.asset.coins.Ether} and tokens like
* {@link haveno.asset.tokens.DaiStablecoin}.
* {@link haveno.asset.tokens.DaiStablecoinERC20}.
* <p>
* The purpose of this package is to provide everything necessary for registering
* ("listing") new assets and managing / accessing those assets within, e.g. the Haveno

View File

@ -19,9 +19,9 @@ package haveno.asset.tokens;
import haveno.asset.Erc20Token;
public class DaiStablecoin extends Erc20Token {
public class DaiStablecoinERC20 extends Erc20Token {
public DaiStablecoin() {
super("Dai Stablecoin", "DAI");
public DaiStablecoinERC20() {
super("Dai Stablecoin", "DAI-ERC20");
}
}

View File

@ -9,4 +9,5 @@ haveno.asset.coins.Litecoin
haveno.asset.coins.Monero
haveno.asset.tokens.TetherUSDERC20
haveno.asset.tokens.TetherUSDTRC20
haveno.asset.tokens.USDCoinERC20
haveno.asset.tokens.USDCoinERC20
haveno.asset.tokens.DaiStablecoinERC20

View File

@ -200,6 +200,7 @@ public class CurrencyUtil {
result.add(new CryptoCurrency("BCH", "Bitcoin Cash"));
result.add(new CryptoCurrency("ETH", "Ether"));
result.add(new CryptoCurrency("LTC", "Litecoin"));
result.add(new CryptoCurrency("DAI-ERC20", "Dai Stablecoin (ERC20)"));
result.add(new CryptoCurrency("USDT-ERC20", "Tether USD (ERC20)"));
result.add(new CryptoCurrency("USDT-TRC20", "Tether USD (TRC20)"));
result.add(new CryptoCurrency("USDC-ERC20", "USD Coin (ERC20)"));
@ -330,7 +331,7 @@ public class CurrencyUtil {
private static boolean isCryptoCurrencyCodeBase(String currencyCode) {
if (currencyCode == null) return false;
currencyCode = currencyCode.toUpperCase();
return currencyCode.equals("USDT") || currencyCode.equals("USDC");
return currencyCode.equals("USDT") || currencyCode.equals("USDC") || currencyCode.equals("DAI");
}
public static String getCurrencyCodeBase(String currencyCode) {
@ -338,6 +339,7 @@ public class CurrencyUtil {
currencyCode = currencyCode.toUpperCase();
if (currencyCode.contains("USDT")) return "USDT";
if (currencyCode.contains("USDC")) return "USDC";
if (currencyCode.contains("DAI")) return "DAI";
return currencyCode;
}