cess icon indicating copy to clipboard operation
cess copied to clipboard

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

Open jimmychu0807 opened this issue 2 years ago • 4 comments

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

jimmychu0807 avatar Sep 26 '23 03:09 jimmychu0807

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

ytqaljn avatar Oct 09 '23 03:10 ytqaljn

@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:

jimmychu0807 avatar Nov 09 '23 23:11 jimmychu0807

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.

ytqaljn avatar Nov 10 '23 01:11 ytqaljn

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

jimmychu0807 avatar Nov 10 '23 03:11 jimmychu0807