Skip to content

Commit 3b71a2a

Browse files
Merge pull request #7464 from BitGo/WIN-7765
feat: added new tokens for mon and xdc
2 parents e39c339 + c7a1062 commit 3b71a2a

File tree

6 files changed

+150
-1
lines changed

6 files changed

+150
-1
lines changed

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,16 @@ export function getTokenConstructor(tokenConfig: TokenConfig): CoinConstructor |
10201020
case 'ton':
10211021
case 'tton':
10221022
return JettonToken.createTokenConstructor(tokenConfig as JettonTokenConfig);
1023+
case 'mon':
1024+
case 'tmon': {
1025+
const coinNames = { Mainnet: 'mon', Testnet: 'tmon' };
1026+
return EthLikeErc20Token.createTokenConstructor(tokenConfig as EthLikeTokenConfig, coinNames);
1027+
}
1028+
case 'xdc':
1029+
case 'txdc': {
1030+
const coinNames = { Mainnet: 'xdc', Testnet: 'txdc' };
1031+
return EthLikeErc20Token.createTokenConstructor(tokenConfig as EthLikeTokenConfig, coinNames);
1032+
}
10231033
default:
10241034
return undefined;
10251035
}

modules/statics/src/allCoinsAndTokens.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,65 @@ export const allCoinsAndTokens = [
25342534
UnderlyingAsset['baseeth:wbrly'],
25352535
Networks.main.basechain
25362536
),
2537+
2538+
// XDC mainnet tokens
2539+
erc20Token(
2540+
'b820932d-5772-49ae-a055-a59760f3e4cf',
2541+
'xdc:usdc',
2542+
'USD Coin',
2543+
6,
2544+
'0xfa2958cb79b0491cc627c1557f441ef849ca8eb1',
2545+
UnderlyingAsset['xdc:usdc'],
2546+
Networks.main.xdc
2547+
),
2548+
erc20Token(
2549+
'8914a1bd-1495-46df-84da-445c6d49edb2',
2550+
'xdc:lbt',
2551+
'Law Block Token',
2552+
18,
2553+
'0x05940b2df33d6371201e7ae099ced4c363855dfe',
2554+
UnderlyingAsset['xdc:lbt'],
2555+
Networks.main.xdc
2556+
),
2557+
erc20Token(
2558+
'f03302de-b06b-4ddc-94a2-ad7e89896725',
2559+
'xdc:gama',
2560+
'Gama Token',
2561+
18,
2562+
'0x3a170c7c987f55c84f28733bfa27962d8cdd5d3b',
2563+
UnderlyingAsset['xdc:gama'],
2564+
Networks.main.xdc
2565+
),
2566+
erc20Token(
2567+
'bdf602ea-3a6c-407a-8afd-33d6c04a8bc3',
2568+
'xdc:srx',
2569+
'STORX',
2570+
18,
2571+
'0x5d5f074837f5d4618b3916ba74de1bf9662a3fed',
2572+
UnderlyingAsset['xdc:srx'],
2573+
Networks.main.xdc
2574+
),
2575+
erc20Token(
2576+
'd42c9497-0987-497d-97f2-8b19c539e350',
2577+
'xdc:weth',
2578+
'Wrapped Ether',
2579+
18,
2580+
'0xa7348290de5cf01772479c48d50dec791c3fc212',
2581+
UnderlyingAsset['xdc:weth'],
2582+
Networks.main.xdc
2583+
),
2584+
2585+
// MON mainnet tokens
2586+
erc20Token(
2587+
'5f15df50-7409-45b8-a7a8-00294a113fcb',
2588+
'mon:wmon',
2589+
'Wrapped MON',
2590+
18,
2591+
'0x3bd359c1119da7da1d913d1c4d2b7c461115433a',
2592+
UnderlyingAsset['mon:wmon'],
2593+
Networks.main.mon
2594+
),
2595+
25372596
hederaCoin(
25382597
'98aad956-27ee-45dd-aa43-6a23c9a1d1d0',
25392598
'hbar',

modules/statics/src/base.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,17 @@ export enum UnderlyingAsset {
28652865
'flow:usdf' = 'flow:usdf',
28662866
'flow:wflow' = 'flow:wflow',
28672867

2868+
// Monad mainnet tokens
2869+
'mon:usdc' = 'mon:usdc',
2870+
'mon:wmon' = 'mon:wmon',
2871+
2872+
// XDC mainnet tokens
2873+
'xdc:usdc' = 'xdc:usdc',
2874+
'xdc:lbt' = 'xdc:lbt',
2875+
'xdc:gama' = 'xdc:gama',
2876+
'xdc:srx' = 'xdc:srx',
2877+
'xdc:weth' = 'xdc:weth',
2878+
28682879
// Arbitrum testnet tokens
28692880
'tarbeth:link' = 'tarbeth:link',
28702881
'tarbeth:xsgd' = 'tarbeth:xsgd',

modules/statics/src/coinFeatures.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,11 @@ export const VET_TOKEN_FEATURES = VET_FEATURES.filter((feature) => feature !== C
657657

658658
export const EVM_NON_EIP1559_FEATURES = [...EVM_FEATURES.filter((feature) => feature !== CoinFeature.EIP1559)];
659659

660-
export const XDC_FEATURES = [...EVM_NON_EIP1559_FEATURES, CoinFeature.ERC20_BULK_TRANSACTION];
660+
export const XDC_FEATURES = [
661+
...EVM_NON_EIP1559_FEATURES,
662+
CoinFeature.ERC20_BULK_TRANSACTION,
663+
CoinFeature.SUPPORTS_ERC20,
664+
];
661665

662666
export const SGB_FEATURES = [...EVM_FEATURES, CoinFeature.ERC20_BULK_TRANSACTION];
663667

modules/statics/src/coins.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
5858
flow: erc20Token,
5959
lineaeth: erc20Token,
6060
seievm: erc20Token,
61+
mon: erc20Token,
62+
xdc: erc20Token,
6163
bsc: bscToken,
6264
celo: celoToken,
6365
cosmos: cosmosToken,
@@ -121,6 +123,8 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
121123
case 'flow':
122124
case 'lineaeth':
123125
case 'seievm':
126+
case 'mon':
127+
case 'xdc':
124128
case 'celo':
125129
case 'eth':
126130
case 'opeth':

modules/statics/src/tokenConfig.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ export interface Tokens {
266266
bera: {
267267
tokens: EthLikeTokenConfig[];
268268
};
269+
mon: {
270+
tokens: EthLikeTokenConfig[];
271+
};
272+
xdc: {
273+
tokens: EthLikeTokenConfig[];
274+
};
269275
apt: {
270276
tokens: AptTokenConfig[];
271277
nftCollections: AptNFTCollectionConfig[];
@@ -307,6 +313,12 @@ export interface Tokens {
307313
bsc: {
308314
tokens: EthLikeTokenConfig[];
309315
};
316+
mon: {
317+
tokens: EthLikeTokenConfig[];
318+
};
319+
xdc: {
320+
tokens: EthLikeTokenConfig[];
321+
};
310322
eos: {
311323
tokens: EosTokenConfig[];
312324
};
@@ -756,6 +768,43 @@ const getFormattedSeievmTokens = (customCoinMap = coins) =>
756768
return acc;
757769
}, []);
758770

771+
function getMonadTokenConfig(coin: EthLikeERC20Token): EthLikeTokenConfig {
772+
return {
773+
type: coin.name,
774+
coin: coin.network.type === NetworkType.MAINNET ? 'mon' : 'tmon',
775+
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
776+
name: coin.fullName,
777+
tokenContractAddress: coin.contractAddress.toString().toLowerCase(),
778+
decimalPlaces: coin.decimalPlaces,
779+
};
780+
}
781+
const getFormattedMonadTokens = (customCoinMap = coins) =>
782+
customCoinMap.reduce((acc: EthLikeTokenConfig[], coin) => {
783+
if (coin instanceof EthLikeERC20Token && (coin.name.includes('mon:') || coin.name.includes('tmon:'))) {
784+
acc.push(getMonadTokenConfig(coin));
785+
}
786+
return acc;
787+
}, []);
788+
789+
function getXdcTokenConfig(coin: EthLikeERC20Token): EthLikeTokenConfig {
790+
return {
791+
type: coin.name,
792+
coin: coin.network.type === NetworkType.MAINNET ? 'xdc' : 'txdc',
793+
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
794+
name: coin.fullName,
795+
tokenContractAddress: coin.contractAddress.toString().toLowerCase(),
796+
decimalPlaces: coin.decimalPlaces,
797+
};
798+
}
799+
800+
const getFormattedXdcTokens = (customCoinMap = coins) =>
801+
customCoinMap.reduce((acc: EthLikeTokenConfig[], coin) => {
802+
if (coin instanceof EthLikeERC20Token && (coin.name.includes('xdc:') || coin.name.includes('txdc:'))) {
803+
acc.push(getXdcTokenConfig(coin));
804+
}
805+
return acc;
806+
}, []);
807+
759808
function getFlowTokenConfig(coin: EthLikeERC20Token): EthLikeTokenConfig {
760809
return {
761810
type: coin.name,
@@ -1258,6 +1307,12 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
12581307
flow: {
12591308
tokens: getFormattedFlowTokens(coinMap).filter((token) => token.network === 'Mainnet'),
12601309
},
1310+
mon: {
1311+
tokens: getFormattedMonadTokens(coinMap).filter((token) => token.network === 'Mainnet'),
1312+
},
1313+
xdc: {
1314+
tokens: getFormattedXdcTokens(coinMap).filter((token) => token.network === 'Mainnet'),
1315+
},
12611316
lineaeth: {
12621317
tokens: getFormattedLineaethTokens(coinMap).filter((token) => token.network === 'Mainnet'),
12631318
},
@@ -1377,6 +1432,12 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
13771432
flow: {
13781433
tokens: getFormattedFlowTokens(coinMap).filter((token) => token.network === 'Testnet'),
13791434
},
1435+
mon: {
1436+
tokens: getFormattedMonadTokens(coinMap).filter((token) => token.network === 'Testnet'),
1437+
},
1438+
xdc: {
1439+
tokens: getFormattedXdcTokens(coinMap).filter((token) => token.network === 'Testnet'),
1440+
},
13801441
lineaeth: {
13811442
tokens: getFormattedLineaethTokens(coinMap).filter((token) => token.network === 'Testnet'),
13821443
},

0 commit comments

Comments
 (0)