-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathassets-dictionary.ts
204 lines (194 loc) · 4.87 KB
/
assets-dictionary.ts
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import { Asset } from 'types/asset';
import docIcon from 'assets/images/tokens/doc.svg';
import usdtIcon from 'assets/images/tokens/usdt.svg';
import xusdIcon from 'assets/images/tokens/xusd.svg';
import rbtcIcon from 'assets/images/tokens/rbtc.svg';
import bproIcon from 'assets/images/tokens/bpro.svg';
import sovIcon from 'assets/images/tokens/sov.svg';
import ethIcon from 'assets/images/tokens/eth.svg';
import bnbIcon from 'assets/images/tokens/bnb.svg';
import mocIcon from 'assets/images/tokens/moc.svg';
import fishIcon from 'assets/images/tokens/babelfish.svg';
import rdoc from 'assets/images/tokens/rifd.svg';
import rifToken from 'assets/images/tokens/rif.svg';
import mintIcon from 'assets/images/tokens/mint.svg';
import zusdIcon from 'assets/images/tokens/zusd.svg';
import dllrIcon from 'assets/images/tokens/dllr.svg';
import { AssetDetails } from '../models/asset-details';
import { isMainnet } from 'utils/classifiers';
export class AssetsDictionary {
public static assets: Map<Asset, AssetDetails> = new Map<Asset, AssetDetails>(
[
[
Asset.RBTC,
new AssetDetails(Asset.RBTC, 'RBTC', 'Bitcoin', 18, 8, rbtcIcon, true),
],
[
Asset.WRBTC,
new AssetDetails(
Asset.WRBTC,
'WRBTC',
'Wrapped Bitcoin',
18,
8,
rbtcIcon,
false,
true,
),
],
[
Asset.SOV,
new AssetDetails(Asset.SOV, 'SOV', 'Sovryn', 18, 3, sovIcon, true),
],
[
Asset.XUSD,
new AssetDetails(Asset.XUSD, 'XUSD', 'XUSD', 18, 3, xusdIcon, true),
],
[
Asset.ETH,
new AssetDetails(Asset.ETH, 'ETH', 'Ethereum', 18, 6, ethIcon, true),
],
[
Asset.BNB,
new AssetDetails(
Asset.BNB,
'BNB',
'Binance Coin',
18,
6,
bnbIcon,
true,
),
],
[
Asset.USDT,
new AssetDetails(Asset.USDT, 'USDT', 'USDT', 18, 3, usdtIcon, true),
],
[
Asset.MOC,
new AssetDetails(
Asset.MOC,
'MoC',
'Money on Chain',
18,
3,
mocIcon,
true,
),
],
[
Asset.DOC,
new AssetDetails(
Asset.DOC,
'DoC',
'Dollar on Chain',
18,
3,
docIcon,
true,
),
],
[
Asset.RDOC,
new AssetDetails(
Asset.RDOC,
'RDOC',
'RIF Dollar on Chain',
18,
3,
rdoc,
false,
true,
),
],
[
Asset.BPRO,
new AssetDetails(Asset.BPRO, 'BPRO', 'BitPro', 18, 8, bproIcon, true),
],
[
Asset.CSOV,
new AssetDetails(
Asset.CSOV,
'C-SOV',
'C-Sovryn',
18,
3,
sovIcon,
false,
true,
),
],
[
Asset.FISH,
new AssetDetails(Asset.FISH, 'FISH', 'FISH', 18, 3, fishIcon, true),
],
// Uncomment if you want to test Deposit/Withdraw of margin tokens
// [
// Asset.BTCS,
// new AssetDetails(
// Asset.BTCS,
// 'PERPETUALS',
// 'PERPETUALS',
// 18,
// fishIcon,
// true,
// ),
// ],
[
Asset.RIF,
new AssetDetails(Asset.RIF, 'RIF', 'RIF', 18, 3, rifToken, true),
],
[
Asset.MYNT,
new AssetDetails(Asset.MYNT, 'MYNT', 'MYNT', 18, 3, mintIcon, true),
],
[
Asset.ZUSD,
new AssetDetails(Asset.ZUSD, 'ZUSD', 'ZUSD', 18, 2, zusdIcon, false),
],
[
Asset.DLLR,
new AssetDetails(Asset.DLLR, 'DLLR', 'DLLR', 18, 2, dllrIcon, true),
],
],
);
public static get(asset: Asset): AssetDetails {
return this.assets.get(asset) as AssetDetails;
}
public static getByLoanContractAddress(address: string): AssetDetails {
return this.list().find(
item =>
item?.lendingContract?.address.toLowerCase() === address.toLowerCase(),
) as AssetDetails;
}
public static getByTokenContractAddress(address: string): AssetDetails {
return this.list().find(
item =>
item.tokenContract.address.toLowerCase() === address.toLowerCase(),
) as AssetDetails;
}
public static list(): Array<AssetDetails> {
return Array.from(this.assets.values());
}
public static assetList(): Array<Asset> {
return Array.from(this.assets.keys());
}
public static find(assets: Array<Asset>): Array<AssetDetails> {
return assets.map(asset => this.get(asset));
}
}
if (!isMainnet) {
AssetsDictionary.assets.set(
Asset.XUSD_legacy,
new AssetDetails(
Asset.XUSD_legacy,
'XUSD*',
'XUSD Legacy',
18,
3,
xusdIcon,
false,
true,
),
);
}