Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using different tokens on ParaTimes #1265

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

csillag
Copy link
Contributor

@csillag csillag commented Feb 16, 2024

Up to now, we assumed that the native token on each ParaTime is always the same as the native token on the network.

Unfortunately this is not always true, so now we have to make it possible to use different tokens on paratimes.

Copy link

github-actions bot commented Feb 16, 2024

Deployed to Cloudflare Pages

Latest commit: 3520ce16583774bcc9a77e5425ef3e5b80203bce
Status:✅ Deploy successful!
Preview URL: https://79eb95cf.oasis-explorer.pages.dev

@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch from a96fb2a to c99910b Compare February 16, 2024 01:20
@csillag csillag marked this pull request as ready for review February 16, 2024 01:20
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch from c99910b to e1d3ffd Compare February 16, 2024 01:23
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch 2 times, most recently from 1c19e4b to bd8e8ad Compare February 16, 2024 13:21
@csillag
Copy link
Contributor Author

csillag commented Feb 16, 2024

Wait, let me adjust this so that we can support multiple tokens for paratimes...

@csillag csillag marked this pull request as draft February 16, 2024 14:00
@lubej lubej self-requested a review February 16, 2024 14:17
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch from bd8e8ad to fa44b4c Compare February 16, 2024 14:23
@lubej lubej self-requested a review February 16, 2024 16:27
src/config.ts Outdated Show resolved Hide resolved
src/app/utils/__tests__/externalLinks.test.ts Outdated Show resolved Hide resolved
src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx Outdated Show resolved Hide resolved
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch 4 times, most recently from 3a89941 to 30a6d9a Compare February 21, 2024 02:08
@csillag csillag marked this pull request as ready for review February 21, 2024 02:15
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch 2 times, most recently from 62409af to d37cc87 Compare February 21, 2024 03:05
Up to now, we assumed that the native token on each ParaTime
is always the same as the native token on the network.

Unfortunately this is not always true, so now we have to make
it possible to use different tokens on paratimes.
- Rename a NativeTicker to Ticker
- Add EUROe token (and logo)
- Add metadata about known native tokens:
  - Ticker (symbol)
  - Is this a free token?
  - CoinGecko id
- Generalize RosePriceCard to TokenPriceCard
- Enhance layer token configuration
  - Describe the token, not the ticker
  - Support multiple tokens per layer
  - Define the tokens for the Pontus-X layer
- CoinGecko: support pulling all wanted prices
- Nexus API:
  - When loading data, observe the layer token configuration
- Added RuntimeBalanceDisplay: a component for displaying balances
  in multiple tokens.
- Added FiatMoneyAmount: a component for displaying fiat money value
  for balances in multiple tokens, summarizing value from all tokens.
- ParaTimeSnapshot: display price/faucet for first token
The preferred fiat currency can now be configured
per paratime / network.
@csillag csillag force-pushed the csillag/special-ticker-for-paratime branch from d37cc87 to 3520ce1 Compare February 21, 2024 03:40
@csillag csillag merged commit a69897d into master Feb 21, 2024
8 checks passed
@csillag csillag deleted the csillag/special-ticker-for-paratime branch February 21, 2024 03:42
isFree: !!token.free,
hasUsedCoinGecko: !!token.geckoId,
price: token.geckoId && geckoPrices ? (geckoPrices as any)[token.geckoId] : undefined,
fiatCurrency: token.geckoId && geckoPrices ? fiatCurrency : 'xx',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'xx'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be an empty string. Anyway, since we don't have a price, the name of the currency will never be displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, we could simply use the provided fiatCurrency, too. It doesn't matter, since (missing the price) it won't be displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #1285.

@csillag csillag mentioned this pull request Feb 21, 2024
Comment on lines 753 to +755
paraTimesConfig[runtime].decimals,
),
Denomination: getTickerForNetwork(network),
Denomination: getTokensForScope({ network, layer: runtime })[0].ticker, // TODO find this out from event data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to differentiate decimals based on denomination. If EUROe has the same number of decimals as TEST, that is only coincidentally and unreliable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, decimals are not yet solved. However this code has been updated later in #1279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants