feat/currency rounding (#3041)
* feat(@desktop/wallet): added iso4217 library for fiat currency display decimals * feat(@desktop/wallet): added token peg info and use numbers for token market values * feat(@desktop/wallet): extend wallet api to fetch prices in multiple currencies * chore(@desktop/wallet): rename token peg field for clarity
This commit is contained in:
parent
9137257638
commit
3d22f4a86d
1
go.mod
1
go.mod
|
@ -80,6 +80,7 @@ require github.com/fogleman/gg v1.3.0
|
|||
require (
|
||||
github.com/gorilla/sessions v1.2.1
|
||||
github.com/meirf/gopart v0.0.0-20180520194036-37e9492a85a8
|
||||
github.com/rmg/iso4217 v1.0.0
|
||||
github.com/waku-org/go-waku v0.2.3-test.0.20221212154545-7443daea4cd4
|
||||
)
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1835,6 +1835,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
|
|||
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
|
||||
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
|
||||
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
|
||||
github.com/rmg/iso4217 v1.0.0 h1:qZP5nhSwHDKkgpuapOL6BDfHUbBgwXfiPTbPGcwZ92E=
|
||||
github.com/rmg/iso4217 v1.0.0/go.mod h1:AbFI9wPu0EAO+Q6swPiMEfAtyz7T7EfNigAOKNNyiBE=
|
||||
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
|
|
|
@ -2,10 +2,13 @@ package wallet
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
"github.com/rmg/iso4217"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
@ -312,14 +315,14 @@ func (api *API) GetEthereumChains(ctx context.Context, onlyEnabled bool) ([]*par
|
|||
return api.s.rpcClient.NetworkManager.Get(onlyEnabled)
|
||||
}
|
||||
|
||||
func (api *API) FetchPrices(ctx context.Context, symbols []string, currency string) (map[string]float64, error) {
|
||||
func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]float64, error) {
|
||||
log.Debug("call to FetchPrices")
|
||||
return fetchCryptoComparePrices(symbols, currency)
|
||||
return fetchCryptoComparePrices(symbols, currencies)
|
||||
}
|
||||
|
||||
func (api *API) FetchMarketValues(ctx context.Context, symbols []string, currency string) (map[string]MarketCoinValues, error) {
|
||||
func (api *API) FetchMarketValues(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]MarketCoinValues, error) {
|
||||
log.Debug("call to FetchMarketValues")
|
||||
return fetchTokenMarketValues(symbols, currency)
|
||||
return fetchTokenMarketValues(symbols, currencies)
|
||||
}
|
||||
|
||||
func (api *API) GetHourlyMarketValues(ctx context.Context, symbol string, currency string, limit int, aggregate int) ([]TokenHistoricalPairs, error) {
|
||||
|
@ -521,3 +524,19 @@ func (api *API) CreateMultiTransaction(ctx context.Context, multiTransaction *Mu
|
|||
log.Debug("[WalletAPI:: CreateMultiTransaction] create multi transaction")
|
||||
return api.s.transactionManager.createMultiTransaction(ctx, multiTransaction, data, api.router.bridges, password)
|
||||
}
|
||||
|
||||
func (api *API) IsCurrencyFiat(name string) bool {
|
||||
code, _ := iso4217.ByName(strings.ToUpper(name))
|
||||
|
||||
return (code != 0)
|
||||
}
|
||||
|
||||
func (api *API) GetFiatCurrencyMinorUnit(name string) (int, error) {
|
||||
code, minor := iso4217.ByName(strings.ToUpper(name))
|
||||
|
||||
if code == 0 {
|
||||
return code, errors.New("Unknown currency: " + name)
|
||||
}
|
||||
|
||||
return minor, nil
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ type Coin struct {
|
|||
}
|
||||
|
||||
type MarketCoinValues struct {
|
||||
MKTCAP string `json:"MKTCAP"`
|
||||
HIGHDAY string `json:"HIGHDAY"`
|
||||
LOWDAY string `json:"LOWDAY"`
|
||||
CHANGEPCTHOUR string `json:"CHANGEPCTHOUR"`
|
||||
CHANGEPCTDAY string `json:"CHANGEPCTDAY"`
|
||||
CHANGEPCT24HOUR string `json:"CHANGEPCT24HOUR"`
|
||||
CHANGE24HOUR string `json:"CHANGE24HOUR"`
|
||||
MKTCAP float64 `json:"MKTCAP"`
|
||||
HIGHDAY float64 `json:"HIGHDAY"`
|
||||
LOWDAY float64 `json:"LOWDAY"`
|
||||
CHANGEPCTHOUR float64 `json:"CHANGEPCTHOUR"`
|
||||
CHANGEPCTDAY float64 `json:"CHANGEPCTDAY"`
|
||||
CHANGEPCT24HOUR float64 `json:"CHANGEPCT24HOUR"`
|
||||
CHANGE24HOUR float64 `json:"CHANGE24HOUR"`
|
||||
}
|
||||
|
||||
type TokenHistoricalPairs struct {
|
||||
|
@ -61,7 +61,7 @@ type CoinsContainer struct {
|
|||
}
|
||||
|
||||
type MarketValuesContainer struct {
|
||||
Display map[string]map[string]MarketCoinValues `json:"Display"`
|
||||
Raw map[string]map[string]MarketCoinValues `json:"Raw"`
|
||||
}
|
||||
|
||||
func renameSymbols(symbols []string) (renames []string) {
|
||||
|
@ -94,13 +94,14 @@ func chunkSymbols(symbols []string) [][]string {
|
|||
return chunks
|
||||
}
|
||||
|
||||
func fetchCryptoComparePrices(symbols []string, currency string) (map[string]float64, error) {
|
||||
func fetchCryptoComparePrices(symbols []string, currencies []string) (map[string]map[string]float64, error) {
|
||||
chunks := chunkSymbols(symbols)
|
||||
result := make(map[string]float64)
|
||||
result := make(map[string]map[string]float64)
|
||||
realCurrencies := renameSymbols(currencies)
|
||||
for _, smbls := range chunks {
|
||||
realSymbols := renameSymbols(smbls)
|
||||
httpClient := http.Client{Timeout: time.Minute}
|
||||
url := fmt.Sprintf("%s/data/pricemulti?fsyms=%s&tsyms=%s&extraParams=Status.im", cryptocompareURL, strings.Join(realSymbols, ","), currency)
|
||||
url := fmt.Sprintf("%s/data/pricemulti?fsyms=%s&tsyms=%s&extraParams=Status.im", cryptocompareURL, strings.Join(realSymbols, ","), strings.Join(realCurrencies, ","))
|
||||
resp, err := httpClient.Get(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -119,7 +120,10 @@ func fetchCryptoComparePrices(symbols []string, currency string) (map[string]flo
|
|||
}
|
||||
|
||||
for _, symbol := range smbls {
|
||||
result[symbol] = prices[getRealSymbol(symbol)][strings.ToUpper(currency)]
|
||||
result[symbol] = map[string]float64{}
|
||||
for _, currency := range currencies {
|
||||
result[symbol][currency] = prices[getRealSymbol(symbol)][getRealSymbol(currency)]
|
||||
}
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
|
@ -155,12 +159,13 @@ func fetchCryptoCompareTokenDetails(symbols []string) (map[string]Coin, error) {
|
|||
return coins, nil
|
||||
}
|
||||
|
||||
func fetchTokenMarketValues(symbols []string, currency string) (map[string]MarketCoinValues, error) {
|
||||
func fetchTokenMarketValues(symbols []string, currencies []string) (map[string]map[string]MarketCoinValues, error) {
|
||||
realCurrencies := renameSymbols(currencies)
|
||||
realSymbols := renameSymbols(symbols)
|
||||
item := map[string]MarketCoinValues{}
|
||||
item := map[string]map[string]MarketCoinValues{}
|
||||
httpClient := http.Client{Timeout: time.Minute}
|
||||
|
||||
url := fmt.Sprintf("%s/data/pricemultifull?fsyms=%s&tsyms=%s&extraParams=Status.im", cryptocompareURL, strings.Join(realSymbols, ","), currency)
|
||||
url := fmt.Sprintf("%s/data/pricemultifull?fsyms=%s&tsyms=%s&extraParams=Status.im", cryptocompareURL, strings.Join(realSymbols, ","), strings.Join(realCurrencies, ","))
|
||||
resp, err := httpClient.Get(url)
|
||||
if err != nil {
|
||||
return item, err
|
||||
|
@ -179,7 +184,10 @@ func fetchTokenMarketValues(symbols []string, currency string) (map[string]Marke
|
|||
}
|
||||
|
||||
for _, symbol := range symbols {
|
||||
item[symbol] = container.Display[getRealSymbol(symbol)][strings.ToUpper(currency)]
|
||||
item[symbol] = map[string]MarketCoinValues{}
|
||||
for _, currency := range currencies {
|
||||
item[symbol][currency] = container.Raw[getRealSymbol(symbol)][getRealSymbol(currency)]
|
||||
}
|
||||
}
|
||||
|
||||
return item, nil
|
||||
|
|
|
@ -20,6 +20,10 @@ import (
|
|||
// WalletTickReload emitted every 15mn to reload the wallet balance and history
|
||||
const EventWalletTickReload walletevent.EventType = "wallet-tick-reload"
|
||||
|
||||
func getFixedCurrencies() []string {
|
||||
return []string{"usd"}
|
||||
}
|
||||
|
||||
func NewReader(rpcClient *rpc.Client, tokenManager *token.Manager, accountsDB *accounts.Database, walletFeed *event.Feed) *Reader {
|
||||
return &Reader{rpcClient, tokenManager, accountsDB, walletFeed, nil}
|
||||
}
|
||||
|
@ -32,6 +36,17 @@ type Reader struct {
|
|||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
type TokenMarketValues struct {
|
||||
MarketCap float64 `json:"marketCap"`
|
||||
HighDay float64 `json:"highDay"`
|
||||
LowDay float64 `json:"lowDay"`
|
||||
ChangePctHour float64 `json:"changePctHour"`
|
||||
ChangePctDay float64 `json:"changePctDay"`
|
||||
ChangePct24hour float64 `json:"changePct24hour"`
|
||||
Change24hour float64 `json:"change24hour"`
|
||||
Price float64 `json:"price"`
|
||||
}
|
||||
|
||||
type ChainBalance struct {
|
||||
Balance *big.Float `json:"balance"`
|
||||
Address common.Address `json:"address"`
|
||||
|
@ -47,14 +62,8 @@ type Token struct {
|
|||
Description string `json:"description"`
|
||||
AssetWebsiteURL string `json:"assetWebsiteUrl"`
|
||||
BuiltOn string `json:"builtOn"`
|
||||
MarketCap string `json:"marketCap"`
|
||||
HighDay string `json:"highDay"`
|
||||
LowDay string `json:"lowDay"`
|
||||
ChangePctHour string `json:"changePctHour"`
|
||||
ChangePctDay string `json:"changePctDay"`
|
||||
ChangePct24hour string `json:"changePct24hour"`
|
||||
Change24hour string `json:"change24hour"`
|
||||
CurrencyPrice float64 `json:"currencyPrice"`
|
||||
MarketValuesPerCurrency map[string]TokenMarketValues `json:"marketValuesPerCurrency"`
|
||||
PegSymbol string `json:"pegSymbol"`
|
||||
}
|
||||
|
||||
func getTokenBySymbols(tokens []*token.Token) map[string][]*token.Token {
|
||||
|
@ -130,10 +139,13 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
|
|||
chainIDs = append(chainIDs, network.ChainID)
|
||||
}
|
||||
|
||||
currencies := make([]string, 0)
|
||||
currency, err := r.accountsDB.GetCurrency()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
currencies = append(currencies, currency)
|
||||
currencies = append(currencies, getFixedCurrencies()...)
|
||||
|
||||
allTokens, err := r.tokenManager.GetAllTokens()
|
||||
if err != nil {
|
||||
|
@ -148,14 +160,14 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
|
|||
|
||||
var (
|
||||
group = async.NewAtomicGroup(ctx)
|
||||
prices = map[string]float64{}
|
||||
prices = map[string]map[string]float64{}
|
||||
tokenDetails = map[string]Coin{}
|
||||
tokenMarketValues = map[string]MarketCoinValues{}
|
||||
tokenMarketValues = map[string]map[string]MarketCoinValues{}
|
||||
balances = map[uint64]map[common.Address]map[common.Address]*hexutil.Big{}
|
||||
)
|
||||
|
||||
group.Add(func(parent context.Context) error {
|
||||
prices, err = fetchCryptoComparePrices(tokenSymbols, currency)
|
||||
prices, err = fetchCryptoComparePrices(tokenSymbols, currencies)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -171,7 +183,7 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
|
|||
})
|
||||
|
||||
group.Add(func(parent context.Context) error {
|
||||
tokenMarketValues, err = fetchTokenMarketValues(tokenSymbols, currency)
|
||||
tokenMarketValues, err = fetchTokenMarketValues(tokenSymbols, currencies)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -221,6 +233,20 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
|
|||
}
|
||||
}
|
||||
|
||||
marketValuesPerCurrency := make(map[string]TokenMarketValues)
|
||||
for _, currency := range currencies {
|
||||
marketValuesPerCurrency[currency] = TokenMarketValues{
|
||||
MarketCap: tokenMarketValues[symbol][currency].MKTCAP,
|
||||
HighDay: tokenMarketValues[symbol][currency].HIGHDAY,
|
||||
LowDay: tokenMarketValues[symbol][currency].LOWDAY,
|
||||
ChangePctHour: tokenMarketValues[symbol][currency].CHANGEPCTHOUR,
|
||||
ChangePctDay: tokenMarketValues[symbol][currency].CHANGEPCTDAY,
|
||||
ChangePct24hour: tokenMarketValues[symbol][currency].CHANGEPCT24HOUR,
|
||||
Change24hour: tokenMarketValues[symbol][currency].CHANGE24HOUR,
|
||||
Price: prices[symbol][currency],
|
||||
}
|
||||
}
|
||||
|
||||
walletToken := Token{
|
||||
Name: tokens[0].Name,
|
||||
Color: tokens[0].Color,
|
||||
|
@ -230,14 +256,8 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
|
|||
Description: tokenDetails[symbol].Description,
|
||||
AssetWebsiteURL: tokenDetails[symbol].AssetWebsiteURL,
|
||||
BuiltOn: tokenDetails[symbol].BuiltOn,
|
||||
MarketCap: tokenMarketValues[symbol].MKTCAP,
|
||||
HighDay: tokenMarketValues[symbol].HIGHDAY,
|
||||
LowDay: tokenMarketValues[symbol].LOWDAY,
|
||||
ChangePctHour: tokenMarketValues[symbol].CHANGEPCTHOUR,
|
||||
ChangePctDay: tokenMarketValues[symbol].CHANGEPCTDAY,
|
||||
ChangePct24hour: tokenMarketValues[symbol].CHANGEPCT24HOUR,
|
||||
Change24hour: tokenMarketValues[symbol].CHANGE24HOUR,
|
||||
CurrencyPrice: prices[symbol],
|
||||
MarketValuesPerCurrency: marketValuesPerCurrency,
|
||||
PegSymbol: tokens[0].PegSymbol,
|
||||
}
|
||||
|
||||
result[address] = append(result[address], walletToken)
|
||||
|
|
|
@ -399,10 +399,14 @@ func (r *Router) suggestedRoutes(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
prices, err := fetchCryptoComparePrices([]string{"ETH", tokenSymbol}, "USD")
|
||||
pricesMap, err := fetchCryptoComparePrices([]string{"ETH", tokenSymbol}, []string{"USD"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
prices := make(map[string]float64, 0)
|
||||
for symbol, pricePerCurrency := range pricesMap {
|
||||
prices[symbol] = pricePerCurrency["USD"]
|
||||
}
|
||||
|
||||
var (
|
||||
group = async.NewAtomicGroup(ctx)
|
||||
|
|
|
@ -34,6 +34,10 @@ type Token struct {
|
|||
// to be traded.
|
||||
Decimals uint `json:"decimals"`
|
||||
ChainID uint64 `json:"chainId"`
|
||||
// PegSymbol indicates that the token is pegged to some fiat currency, using the
|
||||
// ISO 4217 alphabetic code. For example, an empty string means it is not
|
||||
// pegged, while "USD" means it's pegged to the United States Dollar.
|
||||
PegSymbol string `json:"pegSymbol"`
|
||||
}
|
||||
|
||||
func (t *Token) IsNative() bool {
|
||||
|
|
|
@ -11,6 +11,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"): &Token{
|
||||
Address: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
||||
|
@ -19,6 +20,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"): &Token{
|
||||
Address: common.HexToAddress("0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"),
|
||||
|
@ -731,6 +733,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x58b6a8a3302369daec383334672404ee733ab239"): &Token{
|
||||
Address: common.HexToAddress("0x58b6a8a3302369daec383334672404ee733ab239"),
|
||||
|
@ -867,6 +870,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xEA26c4aC16D4a5A106820BC8AEE85fd0b7b2b664"): &Token{
|
||||
Address: common.HexToAddress("0xEA26c4aC16D4a5A106820BC8AEE85fd0b7b2b664"),
|
||||
|
@ -883,6 +887,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "XAU",
|
||||
},
|
||||
common.HexToAddress("0x865ec58b06bF6305B886793AA20A2da31D034E68"): &Token{
|
||||
Address: common.HexToAddress("0x865ec58b06bF6305B886793AA20A2da31D034E68"),
|
||||
|
@ -939,6 +944,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "CAD",
|
||||
},
|
||||
common.HexToAddress("0x6710c63432A2De02954fc0f851db07146a6c0312"): &Token{
|
||||
Address: common.HexToAddress("0x6710c63432A2De02954fc0f851db07146a6c0312"),
|
||||
|
@ -979,6 +985,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xD0a4b8946Cb52f0661273bfbC6fD0E0C75Fc6433"): &Token{
|
||||
Address: common.HexToAddress("0xD0a4b8946Cb52f0661273bfbC6fD0E0C75Fc6433"),
|
||||
|
@ -1003,6 +1010,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "GBP",
|
||||
},
|
||||
common.HexToAddress("0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e"): &Token{
|
||||
Address: common.HexToAddress("0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e"),
|
||||
|
@ -1043,6 +1051,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e"): &Token{
|
||||
Address: common.HexToAddress("0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e"),
|
||||
|
@ -1083,6 +1092,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "AUD",
|
||||
},
|
||||
common.HexToAddress("0x66497A283E0a007bA3974e837784C6AE323447de"): &Token{
|
||||
Address: common.HexToAddress("0x66497A283E0a007bA3974e837784C6AE323447de"),
|
||||
|
@ -1171,6 +1181,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xB98d4C97425d9908E66E53A6fDf673ACcA0BE986"): &Token{
|
||||
Address: common.HexToAddress("0xB98d4C97425d9908E66E53A6fDf673ACcA0BE986"),
|
||||
|
@ -1235,6 +1246,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643"): &Token{
|
||||
Address: common.HexToAddress("0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643"),
|
||||
|
@ -1299,6 +1311,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 1,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xc944e90c64b2c07662a292be6244bdf05cda44a7"): &Token{
|
||||
Address: common.HexToAddress("0xc944e90c64b2c07662a292be6244bdf05cda44a7"),
|
||||
|
@ -1457,6 +1470,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 5,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x022e292b44b5a146f2e8ee36ff44d3dd863c915c"): &Token{
|
||||
Address: common.HexToAddress("0x022e292b44b5a146f2e8ee36ff44d3dd863c915c"),
|
||||
|
@ -1491,6 +1505,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 10,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
},
|
||||
100: {
|
||||
|
@ -1511,6 +1526,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 420,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
},
|
||||
42161: {
|
||||
|
@ -1521,6 +1537,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 42161,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"): &Token{
|
||||
Address: common.HexToAddress("0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"),
|
||||
|
@ -1529,6 +1546,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 42161,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"): &Token{
|
||||
Address: common.HexToAddress("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"),
|
||||
|
@ -1537,6 +1555,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 42161,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"): &Token{
|
||||
Address: common.HexToAddress("0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"),
|
||||
|
@ -1577,6 +1596,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 42161,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x23a941036ae778ac51ab04cea08ed6e2fe103614"): &Token{
|
||||
Address: common.HexToAddress("0x23a941036ae778ac51ab04cea08ed6e2fe103614"),
|
||||
|
@ -1593,6 +1613,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 18,
|
||||
ChainID: 42161,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
common.HexToAddress("0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"): &Token{
|
||||
Address: common.HexToAddress("0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"),
|
||||
|
@ -1611,6 +1632,7 @@ var tokenStore = map[uint64]map[common.Address]*Token{
|
|||
Color: "#f8f8f8",
|
||||
Decimals: 6,
|
||||
ChainID: 421613,
|
||||
PegSymbol: "USD",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Ryan Graham
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,5 @@
|
|||
test: constants.go
|
||||
go test -v
|
||||
|
||||
constants.go: src/iso4217-table.xml src/update.go
|
||||
go run src/update.go < src/iso4217-table.xml | gofmt > $@
|
|
@ -0,0 +1,6 @@
|
|||
iso4217
|
||||
=======
|
||||
|
||||
[![Go Reference](https://pkg.go.dev/badge/github.com/rmg/iso4217.svg)](https://pkg.go.dev/github.com/rmg/iso4217)
|
||||
|
||||
Golang convenience library containing ISO 4217 currency codes
|
|
@ -0,0 +1,570 @@
|
|||
// Package iso4217 is a convenience library containing ISO 4217 currency codes
|
||||
package iso4217
|
||||
|
||||
var names = map[int]string{
|
||||
0: "",
|
||||
8: "ALL",
|
||||
12: "DZD",
|
||||
32: "ARS",
|
||||
36: "AUD",
|
||||
44: "BSD",
|
||||
48: "BHD",
|
||||
50: "BDT",
|
||||
51: "AMD",
|
||||
52: "BBD",
|
||||
60: "BMD",
|
||||
64: "BTN",
|
||||
68: "BOB",
|
||||
72: "BWP",
|
||||
84: "BZD",
|
||||
90: "SBD",
|
||||
96: "BND",
|
||||
104: "MMK",
|
||||
108: "BIF",
|
||||
116: "KHR",
|
||||
124: "CAD",
|
||||
132: "CVE",
|
||||
136: "KYD",
|
||||
144: "LKR",
|
||||
152: "CLP",
|
||||
156: "CNY",
|
||||
170: "COP",
|
||||
174: "KMF",
|
||||
188: "CRC",
|
||||
191: "HRK",
|
||||
192: "CUP",
|
||||
203: "CZK",
|
||||
208: "DKK",
|
||||
214: "DOP",
|
||||
222: "SVC",
|
||||
230: "ETB",
|
||||
232: "ERN",
|
||||
238: "FKP",
|
||||
242: "FJD",
|
||||
262: "DJF",
|
||||
270: "GMD",
|
||||
292: "GIP",
|
||||
320: "GTQ",
|
||||
324: "GNF",
|
||||
328: "GYD",
|
||||
332: "HTG",
|
||||
340: "HNL",
|
||||
344: "HKD",
|
||||
348: "HUF",
|
||||
352: "ISK",
|
||||
356: "INR",
|
||||
360: "IDR",
|
||||
364: "IRR",
|
||||
368: "IQD",
|
||||
376: "ILS",
|
||||
388: "JMD",
|
||||
392: "JPY",
|
||||
398: "KZT",
|
||||
400: "JOD",
|
||||
404: "KES",
|
||||
408: "KPW",
|
||||
410: "KRW",
|
||||
414: "KWD",
|
||||
417: "KGS",
|
||||
418: "LAK",
|
||||
422: "LBP",
|
||||
426: "LSL",
|
||||
430: "LRD",
|
||||
434: "LYD",
|
||||
446: "MOP",
|
||||
454: "MWK",
|
||||
458: "MYR",
|
||||
462: "MVR",
|
||||
480: "MUR",
|
||||
484: "MXN",
|
||||
496: "MNT",
|
||||
498: "MDL",
|
||||
504: "MAD",
|
||||
512: "OMR",
|
||||
516: "NAD",
|
||||
524: "NPR",
|
||||
532: "ANG",
|
||||
533: "AWG",
|
||||
548: "VUV",
|
||||
554: "NZD",
|
||||
558: "NIO",
|
||||
566: "NGN",
|
||||
578: "NOK",
|
||||
586: "PKR",
|
||||
590: "PAB",
|
||||
598: "PGK",
|
||||
600: "PYG",
|
||||
604: "PEN",
|
||||
608: "PHP",
|
||||
634: "QAR",
|
||||
643: "RUB",
|
||||
646: "RWF",
|
||||
654: "SHP",
|
||||
682: "SAR",
|
||||
690: "SCR",
|
||||
694: "SLL",
|
||||
702: "SGD",
|
||||
704: "VND",
|
||||
706: "SOS",
|
||||
710: "ZAR",
|
||||
728: "SSP",
|
||||
748: "SZL",
|
||||
752: "SEK",
|
||||
756: "CHF",
|
||||
760: "SYP",
|
||||
764: "THB",
|
||||
776: "TOP",
|
||||
780: "TTD",
|
||||
784: "AED",
|
||||
788: "TND",
|
||||
800: "UGX",
|
||||
807: "MKD",
|
||||
818: "EGP",
|
||||
826: "GBP",
|
||||
834: "TZS",
|
||||
840: "USD",
|
||||
858: "UYU",
|
||||
860: "UZS",
|
||||
882: "WST",
|
||||
886: "YER",
|
||||
901: "TWD",
|
||||
925: "SLE",
|
||||
926: "VED",
|
||||
927: "UYW",
|
||||
928: "VES",
|
||||
929: "MRU",
|
||||
930: "STN",
|
||||
931: "CUC",
|
||||
932: "ZWL",
|
||||
933: "BYN",
|
||||
934: "TMT",
|
||||
936: "GHS",
|
||||
938: "SDG",
|
||||
940: "UYI",
|
||||
941: "RSD",
|
||||
943: "MZN",
|
||||
944: "AZN",
|
||||
946: "RON",
|
||||
947: "CHE",
|
||||
948: "CHW",
|
||||
949: "TRY",
|
||||
950: "XAF",
|
||||
951: "XCD",
|
||||
952: "XOF",
|
||||
953: "XPF",
|
||||
955: "XBA",
|
||||
956: "XBB",
|
||||
957: "XBC",
|
||||
958: "XBD",
|
||||
959: "XAU",
|
||||
960: "XDR",
|
||||
961: "XAG",
|
||||
962: "XPT",
|
||||
963: "XTS",
|
||||
964: "XPD",
|
||||
965: "XUA",
|
||||
967: "ZMW",
|
||||
968: "SRD",
|
||||
969: "MGA",
|
||||
970: "COU",
|
||||
971: "AFN",
|
||||
972: "TJS",
|
||||
973: "AOA",
|
||||
975: "BGN",
|
||||
976: "CDF",
|
||||
977: "BAM",
|
||||
978: "EUR",
|
||||
979: "MXV",
|
||||
980: "UAH",
|
||||
981: "GEL",
|
||||
984: "BOV",
|
||||
985: "PLN",
|
||||
986: "BRL",
|
||||
990: "CLF",
|
||||
994: "XSU",
|
||||
997: "USN",
|
||||
999: "XXX",
|
||||
}
|
||||
|
||||
var codes = map[string]int{
|
||||
"": 0,
|
||||
"ALL": 8,
|
||||
"DZD": 12,
|
||||
"ARS": 32,
|
||||
"AUD": 36,
|
||||
"BSD": 44,
|
||||
"BHD": 48,
|
||||
"BDT": 50,
|
||||
"AMD": 51,
|
||||
"BBD": 52,
|
||||
"BMD": 60,
|
||||
"BTN": 64,
|
||||
"BOB": 68,
|
||||
"BWP": 72,
|
||||
"BZD": 84,
|
||||
"SBD": 90,
|
||||
"BND": 96,
|
||||
"MMK": 104,
|
||||
"BIF": 108,
|
||||
"KHR": 116,
|
||||
"CAD": 124,
|
||||
"CVE": 132,
|
||||
"KYD": 136,
|
||||
"LKR": 144,
|
||||
"CLP": 152,
|
||||
"CNY": 156,
|
||||
"COP": 170,
|
||||
"KMF": 174,
|
||||
"CRC": 188,
|
||||
"HRK": 191,
|
||||
"CUP": 192,
|
||||
"CZK": 203,
|
||||
"DKK": 208,
|
||||
"DOP": 214,
|
||||
"SVC": 222,
|
||||
"ETB": 230,
|
||||
"ERN": 232,
|
||||
"FKP": 238,
|
||||
"FJD": 242,
|
||||
"DJF": 262,
|
||||
"GMD": 270,
|
||||
"GIP": 292,
|
||||
"GTQ": 320,
|
||||
"GNF": 324,
|
||||
"GYD": 328,
|
||||
"HTG": 332,
|
||||
"HNL": 340,
|
||||
"HKD": 344,
|
||||
"HUF": 348,
|
||||
"ISK": 352,
|
||||
"INR": 356,
|
||||
"IDR": 360,
|
||||
"IRR": 364,
|
||||
"IQD": 368,
|
||||
"ILS": 376,
|
||||
"JMD": 388,
|
||||
"JPY": 392,
|
||||
"KZT": 398,
|
||||
"JOD": 400,
|
||||
"KES": 404,
|
||||
"KPW": 408,
|
||||
"KRW": 410,
|
||||
"KWD": 414,
|
||||
"KGS": 417,
|
||||
"LAK": 418,
|
||||
"LBP": 422,
|
||||
"LSL": 426,
|
||||
"LRD": 430,
|
||||
"LYD": 434,
|
||||
"MOP": 446,
|
||||
"MWK": 454,
|
||||
"MYR": 458,
|
||||
"MVR": 462,
|
||||
"MUR": 480,
|
||||
"MXN": 484,
|
||||
"MNT": 496,
|
||||
"MDL": 498,
|
||||
"MAD": 504,
|
||||
"OMR": 512,
|
||||
"NAD": 516,
|
||||
"NPR": 524,
|
||||
"ANG": 532,
|
||||
"AWG": 533,
|
||||
"VUV": 548,
|
||||
"NZD": 554,
|
||||
"NIO": 558,
|
||||
"NGN": 566,
|
||||
"NOK": 578,
|
||||
"PKR": 586,
|
||||
"PAB": 590,
|
||||
"PGK": 598,
|
||||
"PYG": 600,
|
||||
"PEN": 604,
|
||||
"PHP": 608,
|
||||
"QAR": 634,
|
||||
"RUB": 643,
|
||||
"RWF": 646,
|
||||
"SHP": 654,
|
||||
"SAR": 682,
|
||||
"SCR": 690,
|
||||
"SLL": 694,
|
||||
"SGD": 702,
|
||||
"VND": 704,
|
||||
"SOS": 706,
|
||||
"ZAR": 710,
|
||||
"SSP": 728,
|
||||
"SZL": 748,
|
||||
"SEK": 752,
|
||||
"CHF": 756,
|
||||
"SYP": 760,
|
||||
"THB": 764,
|
||||
"TOP": 776,
|
||||
"TTD": 780,
|
||||
"AED": 784,
|
||||
"TND": 788,
|
||||
"UGX": 800,
|
||||
"MKD": 807,
|
||||
"EGP": 818,
|
||||
"GBP": 826,
|
||||
"TZS": 834,
|
||||
"USD": 840,
|
||||
"UYU": 858,
|
||||
"UZS": 860,
|
||||
"WST": 882,
|
||||
"YER": 886,
|
||||
"TWD": 901,
|
||||
"SLE": 925,
|
||||
"VED": 926,
|
||||
"UYW": 927,
|
||||
"VES": 928,
|
||||
"MRU": 929,
|
||||
"STN": 930,
|
||||
"CUC": 931,
|
||||
"ZWL": 932,
|
||||
"BYN": 933,
|
||||
"TMT": 934,
|
||||
"GHS": 936,
|
||||
"SDG": 938,
|
||||
"UYI": 940,
|
||||
"RSD": 941,
|
||||
"MZN": 943,
|
||||
"AZN": 944,
|
||||
"RON": 946,
|
||||
"CHE": 947,
|
||||
"CHW": 948,
|
||||
"TRY": 949,
|
||||
"XAF": 950,
|
||||
"XCD": 951,
|
||||
"XOF": 952,
|
||||
"XPF": 953,
|
||||
"XBA": 955,
|
||||
"XBB": 956,
|
||||
"XBC": 957,
|
||||
"XBD": 958,
|
||||
"XAU": 959,
|
||||
"XDR": 960,
|
||||
"XAG": 961,
|
||||
"XPT": 962,
|
||||
"XTS": 963,
|
||||
"XPD": 964,
|
||||
"XUA": 965,
|
||||
"ZMW": 967,
|
||||
"SRD": 968,
|
||||
"MGA": 969,
|
||||
"COU": 970,
|
||||
"AFN": 971,
|
||||
"TJS": 972,
|
||||
"AOA": 973,
|
||||
"BGN": 975,
|
||||
"CDF": 976,
|
||||
"BAM": 977,
|
||||
"EUR": 978,
|
||||
"MXV": 979,
|
||||
"UAH": 980,
|
||||
"GEL": 981,
|
||||
"BOV": 984,
|
||||
"PLN": 985,
|
||||
"BRL": 986,
|
||||
"CLF": 990,
|
||||
"XSU": 994,
|
||||
"USN": 997,
|
||||
"XXX": 999,
|
||||
}
|
||||
|
||||
var minorUnits = map[int]int{
|
||||
0: 0,
|
||||
8: 2,
|
||||
12: 2,
|
||||
32: 2,
|
||||
36: 2,
|
||||
44: 2,
|
||||
48: 3,
|
||||
50: 2,
|
||||
51: 2,
|
||||
52: 2,
|
||||
60: 2,
|
||||
64: 2,
|
||||
68: 2,
|
||||
72: 2,
|
||||
84: 2,
|
||||
90: 2,
|
||||
96: 2,
|
||||
104: 2,
|
||||
108: 0,
|
||||
116: 2,
|
||||
124: 2,
|
||||
132: 2,
|
||||
136: 2,
|
||||
144: 2,
|
||||
152: 0,
|
||||
156: 2,
|
||||
170: 2,
|
||||
174: 0,
|
||||
188: 2,
|
||||
191: 2,
|
||||
192: 2,
|
||||
203: 2,
|
||||
208: 2,
|
||||
214: 2,
|
||||
222: 2,
|
||||
230: 2,
|
||||
232: 2,
|
||||
238: 2,
|
||||
242: 2,
|
||||
262: 0,
|
||||
270: 2,
|
||||
292: 2,
|
||||
320: 2,
|
||||
324: 0,
|
||||
328: 2,
|
||||
332: 2,
|
||||
340: 2,
|
||||
344: 2,
|
||||
348: 2,
|
||||
352: 0,
|
||||
356: 2,
|
||||
360: 2,
|
||||
364: 2,
|
||||
368: 3,
|
||||
376: 2,
|
||||
388: 2,
|
||||
392: 0,
|
||||
398: 2,
|
||||
400: 3,
|
||||
404: 2,
|
||||
408: 2,
|
||||
410: 0,
|
||||
414: 3,
|
||||
417: 2,
|
||||
418: 2,
|
||||
422: 2,
|
||||
426: 2,
|
||||
430: 2,
|
||||
434: 3,
|
||||
446: 2,
|
||||
454: 2,
|
||||
458: 2,
|
||||
462: 2,
|
||||
480: 2,
|
||||
484: 2,
|
||||
496: 2,
|
||||
498: 2,
|
||||
504: 2,
|
||||
512: 3,
|
||||
516: 2,
|
||||
524: 2,
|
||||
532: 2,
|
||||
533: 2,
|
||||
548: 0,
|
||||
554: 2,
|
||||
558: 2,
|
||||
566: 2,
|
||||
578: 2,
|
||||
586: 2,
|
||||
590: 2,
|
||||
598: 2,
|
||||
600: 0,
|
||||
604: 2,
|
||||
608: 2,
|
||||
634: 2,
|
||||
643: 2,
|
||||
646: 0,
|
||||
654: 2,
|
||||
682: 2,
|
||||
690: 2,
|
||||
694: 2,
|
||||
702: 2,
|
||||
704: 0,
|
||||
706: 2,
|
||||
710: 2,
|
||||
728: 2,
|
||||
748: 2,
|
||||
752: 2,
|
||||
756: 2,
|
||||
760: 2,
|
||||
764: 2,
|
||||
776: 2,
|
||||
780: 2,
|
||||
784: 2,
|
||||
788: 3,
|
||||
800: 0,
|
||||
807: 2,
|
||||
818: 2,
|
||||
826: 2,
|
||||
834: 2,
|
||||
840: 2,
|
||||
858: 2,
|
||||
860: 2,
|
||||
882: 2,
|
||||
886: 2,
|
||||
901: 2,
|
||||
925: 2,
|
||||
926: 2,
|
||||
927: 4,
|
||||
928: 2,
|
||||
929: 2,
|
||||
930: 2,
|
||||
931: 2,
|
||||
932: 2,
|
||||
933: 2,
|
||||
934: 2,
|
||||
936: 2,
|
||||
938: 2,
|
||||
940: 0,
|
||||
941: 2,
|
||||
943: 2,
|
||||
944: 2,
|
||||
946: 2,
|
||||
947: 2,
|
||||
948: 2,
|
||||
949: 2,
|
||||
950: 0,
|
||||
951: 2,
|
||||
952: 0,
|
||||
953: 0,
|
||||
955: 0,
|
||||
956: 0,
|
||||
957: 0,
|
||||
958: 0,
|
||||
959: 0,
|
||||
960: 0,
|
||||
961: 0,
|
||||
962: 0,
|
||||
963: 0,
|
||||
964: 0,
|
||||
965: 0,
|
||||
967: 2,
|
||||
968: 2,
|
||||
969: 2,
|
||||
970: 2,
|
||||
971: 2,
|
||||
972: 2,
|
||||
973: 2,
|
||||
975: 2,
|
||||
976: 2,
|
||||
977: 2,
|
||||
978: 2,
|
||||
979: 2,
|
||||
980: 2,
|
||||
981: 2,
|
||||
984: 2,
|
||||
985: 2,
|
||||
986: 2,
|
||||
990: 4,
|
||||
994: 0,
|
||||
997: 2,
|
||||
999: 0,
|
||||
}
|
||||
|
||||
// ByCode resolves the given code to the 3 character string and the number of
|
||||
// minor unit digits to display for the given currency.
|
||||
func ByCode(n int) (string, int) {
|
||||
return names[n], minorUnits[n]
|
||||
}
|
||||
|
||||
// ByName resolves the given name to the numeric code and the number of minor
|
||||
// unit digits to display for the given currency.
|
||||
func ByName(s string) (int, int) {
|
||||
code := codes[s]
|
||||
return code, minorUnits[code]
|
||||
}
|
|
@ -865,6 +865,9 @@ github.com/rivo/uniseg
|
|||
# github.com/rjeczalik/notify v0.9.2
|
||||
## explicit
|
||||
github.com/rjeczalik/notify
|
||||
# github.com/rmg/iso4217 v1.0.0
|
||||
## explicit; go 1.12
|
||||
github.com/rmg/iso4217
|
||||
# github.com/rs/cors v1.7.0
|
||||
## explicit
|
||||
github.com/rs/cors
|
||||
|
|
Loading…
Reference in New Issue