Skip to content

Commit 3cebb40

Browse files
gsteenkamp89bmzig
andauthored
feat(utils): utility to check if token is stablecoin (#969)
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org> Co-authored-by: bmzig <57361391+bmzig@users.noreply.github.com>
1 parent 24d2de2 commit 3cebb40

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@across-protocol/sdk",
33
"author": "UMA Team",
4-
"version": "4.1.43",
4+
"version": "4.1.44",
55
"license": "AGPL-3.0",
66
"homepage": "https://docs.across.to/reference/sdk",
77
"files": [

src/constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ export const BRIDGED_USDC_SYMBOLS = [
6666
TOKEN_SYMBOLS_MAP.USDzC.symbol,
6767
];
6868

69+
export const STABLE_COIN_SYMBOLS = [
70+
...BRIDGED_USDC_SYMBOLS,
71+
TOKEN_SYMBOLS_MAP.USDB.symbol,
72+
TOKEN_SYMBOLS_MAP.USDC.symbol,
73+
TOKEN_SYMBOLS_MAP.USDT.symbol,
74+
TOKEN_SYMBOLS_MAP.DAI.symbol,
75+
TOKEN_SYMBOLS_MAP["TATARA-USDC"].symbol,
76+
TOKEN_SYMBOLS_MAP["TATARA-USDT"].symbol,
77+
TOKEN_SYMBOLS_MAP["TATARA-USDS"].symbol,
78+
TOKEN_SYMBOLS_MAP.GHO.symbol,
79+
TOKEN_SYMBOLS_MAP.WGHO.symbol,
80+
];
81+
6982
export const CUSTOM_GAS_TOKENS = {
7083
[CHAIN_IDs.POLYGON]: "MATIC",
7184
[CHAIN_IDs.POLYGON_AMOY]: "MATIC",

src/utils/TokenUtils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ export function isBridgedUsdc(tokenSymbol: string): boolean {
109109
);
110110
}
111111

112+
export function isStablecoin(tokenSymbol: string): boolean {
113+
return constants.STABLE_COIN_SYMBOLS.some(
114+
(stablecoinSymbol) => stablecoinSymbol.toLowerCase() === tokenSymbol.toLowerCase()
115+
);
116+
}
117+
112118
export function getTokenInfo(l2TokenAddress: string, chainId: number): L1Token {
113119
// @dev This might give false positives if tokens on different networks have the same address. I'm not sure how
114120
// to get around this...

0 commit comments

Comments
 (0)