-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathmusd.ts
More file actions
74 lines (62 loc) · 2.35 KB
/
musd.ts
File metadata and controls
74 lines (62 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* mUSD Conversion Constants for Earn namespace
*/
import { CHAIN_IDS } from '@metamask/transaction-controller';
import { Hex } from '@metamask/utils';
import MusdIcon from '../../../../images/musd-icon-2x.png';
export const MUSD_TOKEN = {
symbol: 'mUSD',
name: 'MetaMask USD',
decimals: 6,
imageSource: MusdIcon,
} as const;
/**
* mUSD token decimals (derived from MUSD_TOKEN for single source of truth)
*/
export const MUSD_DECIMALS = MUSD_TOKEN.decimals;
export const MUSD_CONVERSION_DEFAULT_CHAIN_ID = CHAIN_IDS.MAINNET;
/**
* mUSD token address (same on all supported chains)
*/
export const MUSD_TOKEN_ADDRESS: Hex =
'0xaca92e438df0b2401ff60da7e4337b687a2435da';
export const MUSD_TOKEN_ADDRESS_BY_CHAIN: Record<Hex, Hex> = {
[CHAIN_IDS.MAINNET]: MUSD_TOKEN_ADDRESS,
[CHAIN_IDS.LINEA_MAINNET]: MUSD_TOKEN_ADDRESS,
[CHAIN_IDS.BSC]: MUSD_TOKEN_ADDRESS,
};
/**
* Check if the given token address is mUSD.
* mUSD has the same address on all supported chains.
*/
export const isMusdToken = (address?: string): boolean => {
if (!address) return false;
const musdAddress = MUSD_TOKEN_ADDRESS_BY_CHAIN[CHAIN_IDS.MAINNET];
return address.toLowerCase() === musdAddress.toLowerCase();
};
/**
* Chains where mUSD CTA should show (buy routes available).
* BSC is excluded as buy routes are not yet available.
*/
export const MUSD_BUYABLE_CHAIN_IDS: Hex[] = [
CHAIN_IDS.MAINNET,
CHAIN_IDS.LINEA_MAINNET,
// CHAIN_IDS.BSC, // TODO: Uncomment once buy routes are available
];
export const MUSD_TOKEN_ASSET_ID_BY_CHAIN: Record<Hex, string> = {
[CHAIN_IDS.MAINNET]:
'eip155:1/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA',
[CHAIN_IDS.LINEA_MAINNET]:
'eip155:59144/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA',
[CHAIN_IDS.BSC]: 'eip155:56/erc20:0xacA92E438df0B2401fF60dA7E4337B687a2435DA',
};
export const MUSD_CURRENCY = 'MUSD';
/** APY in whole percent (e.g. 3 → 3%). Drives Earn UI and Rewards mUSD calculator math and disclaimer copy. */
export const MUSD_CONVERSION_APY = 3;
// Delay before cleaning up toast tracking entries after final transaction status
export const TOAST_TRACKING_CLEANUP_DELAY_MS = 5000;
/**
* Default blocked countries for mUSD conversion when no remote or env config is available.
* This is a safety fallback to ensure geo-blocking is always active.
*/
export const DEFAULT_MUSD_BLOCKED_COUNTRIES = ['GB'];