-
Notifications
You must be signed in to change notification settings - Fork 30
/
assets.go
191 lines (174 loc) · 4.41 KB
/
assets.go
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
// Copyright (c) of parts are held by the various contributors (see the CLA)
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
package common
import "strings"
/* All the assets on pegnet
*
* PegNet, PEG, PEG
*
* US Dollar, USD, pUSD
* Euro, EUR, pEUR
* Japanese Yen, JPY, pJPY
* Pound Sterling, GBP, pGBP
* Canadian Dollar, CAD, pCAD
* Swiss Franc, CHF, pCHF
* Indian Rupee, INR, pINR
* Singapore Dollar, SGD, pSGD
* Chinese Yuan, CNY, pCNY
* Hong Kong Dollar, HKD, pHKD
* DROPPED Tiawanese Dollar, TWD, pTWD
* Korean Won, KRW, pKRW
* DROPPED Argentine Peso, ARS, pARS
* Brazil Real, BRL, pBRL
* Philippine Peso PHP, pPHP
* Mexican Peso MXN, pMXN
*
* Gold Troy Ounce, XAU, pXAU
* Silver Troy Ounce, XAG, pXAG
* Palladium Troy Ounce, XPD, pXPD
* Platinum Troy Ounce, XPT, pXPT
*
* Bitcoin, XBT, pXBT
* Ethereum, ETH, pETH
* Litecoin, LTC, pLTC
* Ravencoin, RVN, pRVN
* Bitcoin Cash, XBC, pXBC
* Factom, FCT, pFCT
* Binance Coin BNB, pBNB
* Stellar XLM, pXLM
* Cardano ADA, pADA
* Monero XMR, pXMR
* Dash DASH, pDASH
* Zcash ZEC, pZEC
* Decred DCR, pDCR
*/
var (
PEGAsset = []string{
"PEG",
}
CurrencyAssets = []string{
"USD",
"EUR",
"JPY",
"GBP",
"CAD",
"CHF",
"INR",
"SGD",
"CNY",
"HKD",
//"TWD",
"KRW",
//"ARS",
"BRL",
"PHP",
"MXN",
}
CommodityAssets = []string{
"XAU",
"XAG",
"XPD",
"XPT",
}
CryptoAssets = []string{
"XBT",
"ETH",
"LTC",
"RVN",
"XBC",
"FCT",
"BNB",
"XLM",
"ADA",
"XMR",
"DASH",
"ZEC",
"DCR",
}
V4CurrencyAdditions = []string{
"AUD",
"NZD",
"SEK",
"NOK",
"RUB",
"ZAR",
"TRY",
}
V4CryptoAdditions = []string{
"EOS",
"LINK",
"ATOM",
"BAT",
"XTZ",
}
V5CryptoAdditions = []string{
"HBAR",
"NEO",
"CRO",
"ETC",
"ONT",
"DOGE",
"VET",
"HT",
"ALGO",
"DGB",
}
V5CurrencyAdditions = []string{
"AED",
"ARS",
"TWD",
"RWF",
"KES",
"UGX",
"TZS",
"BIF",
"ETB",
"NGN",
}
AllAssets = MergeLists(PEGAsset, CurrencyAssets, CommodityAssets, CryptoAssets, V4CurrencyAdditions, V4CryptoAdditions, V5CryptoAdditions, V5CurrencyAdditions)
AssetsV1 = MergeLists(PEGAsset, CurrencyAssets, CommodityAssets, CryptoAssets)
// This is with the PNT instead of PEG. Should never be used unless absolutely necessary.
//
// Deprecated: Was used for version 1 before PNT -> PEG
AssetsV1WithPNT = MergeLists([]string{"PNT"}, SubtractFromSet(AssetsV1, "PEG"))
// Version One, subtract 2 assets
AssetsV2 = SubtractFromSet(AssetsV1, "XPD", "XPT")
// Additional assets to V2 set
AssetsV4 = MergeLists(AssetsV2, V4CurrencyAdditions, V4CryptoAdditions)
// Additional assets to V4 set
AssetsV5 = MergeLists(AssetsV4, V5CryptoAdditions, V5CurrencyAdditions)
)
// AssetListContainsCaseInsensitive is for when using user input. It's helpful for the
// cmd line.
func AssetListContainsCaseInsensitive(assetList []string, asset string) bool {
for _, a := range assetList {
if strings.ToLower(asset) == strings.ToLower(a) {
return true
}
}
return false
}
func AssetListContains(assetList []string, asset string) bool {
for _, a := range assetList {
if asset == a {
return true
}
}
return false
}
func SubtractFromSet(set []string, sub ...string) []string {
var result []string
for _, r := range set {
if !AssetListContains(sub, r) {
result = append(result, r)
}
}
return result
}
func MergeLists(assets ...[]string) []string {
acc := []string{}
for _, list := range assets {
acc = append(acc, list...)
}
return acc
}