Skip to content

Commit

Permalink
Ana/fix coinlookup for multidenom (#565)
Browse files Browse the repository at this point in the history
* add multidenom coinlookups

* move coinlookups to separate file for readability
  • Loading branch information
Bitcoinera authored Apr 4, 2020
1 parent 1f90632 commit 773a6df
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 49 deletions.
100 changes: 100 additions & 0 deletions data/network-coinlookups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
const terraCoinLookup = [
{
chainDenom: 'uluna',
viewDenom: 'LUNA',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'ukrw',
viewDenom: 'KRT',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'ukrw',
viewDenom: 'KRT',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'umnt',
viewDenom: 'MNT',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'usdr',
viewDenom: 'SDT',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'uusd',
viewDenom: 'UST',
chainToViewConversionFactor: 1e-6
}
]
// in the case of e-Money, some tokens only exist in mainnet and viceversa, some tokens only exist in testnet
// still, this will probably soon change with the new testnet
// also it is just more simple to add them all in the same dictionary
const emoneyCoinLookup = [
{
chainDenom: 'ungm',
viewDenom: 'NGM',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'edkk',
viewDenom: 'eDKK',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'enok',
viewDenom: 'eNOK',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'esek',
viewDenom: 'eSEK',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'echf',
viewDenom: 'eCHF',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'eeur',
viewDenom: 'eEUR',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'eusd',
viewDenom: 'eUSD',
chainToViewConversionFactor: 1e-6
},
{
chainDenom: 'ejpy',
viewDenom: 'eJPY',
chainToViewConversionFactor: 1e-6
}
]
const coinLookupDictionary = {
"cosmos-hub-mainnet": [{
chainDenom: 'uatom',
viewDenom: 'ATOM',
chainToViewConversionFactor: 1e-6
}],
"cosmos-hub-testnet": [{
chainDenom: 'umuon',
viewDenom: 'MUON',
chainToViewConversionFactor: 1e-6
}],
"terra-mainnet": terraCoinLookup,
"terra-testnet": terraCoinLookup,
"emoney-mainnet": emoneyCoinLookup,
"emoney-testnet": emoneyCoinLookup,
"polkadot-testnet": [{
chainDenom: 'Planck',
viewDenom: 'KSM',
chainToViewConversionFactor: 1e-12
}]
}

module.exports = {coinLookupDictionary}
57 changes: 8 additions & 49 deletions data/networks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { getNetworkCapabilities } = require('./network-capabilities')
const { coinLookupDictionary } = require('./network-coinlookups')

module.exports = [
{
Expand All @@ -19,13 +20,7 @@ module.exports = [
...getNetworkCapabilities[`cosmos-hub-testnet`],
default: false,
stakingDenom: 'MUON',
coinLookup: [
{
chainDenom: 'umuon',
viewDenom: 'MUON',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`cosmos-hub-testnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/cosmos-hub-mainnet.png',
slug: 'cosmos-hub-testnet',
Expand Down Expand Up @@ -53,13 +48,7 @@ module.exports = [
...getNetworkCapabilities[`cosmos-hub-mainnet`],
default: true,
stakingDenom: 'ATOM',
coinLookup: [
{
chainDenom: 'uatom',
viewDenom: 'ATOM',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`cosmos-hub-mainnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/cosmos-hub-mainnet.png',
slug: 'cosmos-hub',
Expand Down Expand Up @@ -87,13 +76,7 @@ module.exports = [
...getNetworkCapabilities[`terra-mainnet`],
default: false,
stakingDenom: 'LUNA',
coinLookup: [
{
chainDenom: 'uluna',
viewDenom: 'LUNA',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`terra-mainnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/terra-mainnet.png',
slug: 'terra'
Expand All @@ -115,13 +98,7 @@ module.exports = [
...getNetworkCapabilities[`terra-testnet`],
default: false,
stakingDenom: 'LUNA',
coinLookup: [
{
chainDenom: 'uluna',
viewDenom: 'LUNA',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`terra-testnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/terra-testnet.png',
slug: 'terra-testnet'
Expand All @@ -143,13 +120,7 @@ module.exports = [
...getNetworkCapabilities[`emoney-mainnet`],
default: false,
stakingDenom: 'NGM',
coinLookup: [
{
chainDenom: 'ungm',
viewDenom: 'NGM',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`emoney-mainnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/emoney-mainnet.png',
slug: 'emoney'
Expand All @@ -171,13 +142,7 @@ module.exports = [
...getNetworkCapabilities[`emoney-testnet`],
default: false,
stakingDenom: 'NGM',
coinLookup: [
{
chainDenom: 'ungm',
viewDenom: 'NGM',
chainToViewConversionFactor: 1e-6
}
],
coinLookup: coinLookupDictionary[`emoney-testnet`],
enabled: true,
icon: 'https://app.lunie.io/img/networks/emoney-testnet.png',
slug: 'emoney-testnet'
Expand All @@ -200,13 +165,7 @@ module.exports = [
default: false,
stakingDenom: 'KSM',
// https://wiki.polkadot.network/docs/en/learn-DOT
coinLookup: [
{
chainDenom: 'Planck',
viewDenom: 'KSM',
chainToViewConversionFactor: 1e-12
}
],
coinLookup: coinLookupDictionary[`polkadot-testnet`],
enabled: false,
icon: 'https://app.lunie.io/img/networks/polkadot-testnet.png',
slug: 'kusama'
Expand Down

0 comments on commit 773a6df

Please sign in to comment.