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

Unify the unit of currency/balance between Substrate pallet-balance and pallet-evm #234

Closed
jimmychu0807 opened this issue Sep 26, 2023 · 4 comments

Comments

@jimmychu0807
Copy link
Contributor

jimmychu0807 commented Sep 26, 2023

Currently, 1M of native CESS tokens (on Substrate side) = 1 EVM CESS tokens

@ytqaljn
Copy link
Member

ytqaljn commented Oct 9, 2023

Thank you for your discovery. We will fix it in the next version.

@ytqaljn ytqaljn closed this as completed Oct 23, 2023
@ytqaljn ytqaljn reopened this Oct 23, 2023
@ytqaljn ytqaljn closed this as completed Oct 31, 2023
@jimmychu0807
Copy link
Contributor Author

jimmychu0807 commented Nov 9, 2023

@ytqaljn we will need to open this issue and discuss: 1) whether to fix it, 2) the approach to fix it.

The reason that currently 1M of native CESS tokens is shown as 1 EVM CESS tokens is because all EVM wallets use 18 decimals to read the EVM chain native token. There is no way we can configure the decimal places as in reading ERC-20 contracts.

The current approach to fix it are:

  1. Change the Substrate token decimal places to 18 (10^18). This is the approach Moonbeam takes (GLMR is their token name). Currently in CESS, it is set to (10^12) as shown here. This will have a one-time effect on all the Substrate token holders.

  2. Adding a currency adaptor, as Darwinia does, as shown here. Darwinia Substrate native token is 10^9 (9 decimal places) and need to multiply/divide by another 10^9 to convert to EVM token unit back and forth. There are also some runtime config hooking work to extend the pallet to use a currency adapter.

Ref:

@ytqaljn ytqaljn reopened this Nov 10, 2023
@ytqaljn
Copy link
Member

ytqaljn commented Nov 10, 2023

Thank you for your suggestion. Although the second option is more cumbersome, it will have less impact on our network. If you change the decimal place of cess, it will have an impact on other programs such as bucket and go-sdk.

@jimmychu0807
Copy link
Contributor Author

jimmychu0807 commented Nov 10, 2023

回到 SE 讨论。我想 Darwinia 不再维护 CurrencyAdapter 应该是觉得是维护起来很麻烦。除了每次乘/除以外,我想到就是手续费。那 evm 上的手续费就是奇高。就算本身很少,但要乘个 10^9 (它们,我们是 10^6). 还有,到 DEX/CEX 交易所时,你怎样兑?是用 evm token 的单位还是 substrate token 单位? 想到这些,我都觉得直接改到 10^18 就痛一次较好。

@0xbillw 0xbillw closed this as completed May 6, 2024
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

No branches or pull requests

3 participants