-
Notifications
You must be signed in to change notification settings - Fork 352
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
Problem: base denomination can't be parsed with decimal point #16
Comments
@calvinaco is that an issue here? in SDK's codebase, base units aren't really exposed / are rarely used (it seems all "end-user" RPC, CLI, configs etc. specify values in full coins)? |
@tomtau Oh actually this is something I want to clarify first as well. In the SDK the Coin should be If we look into the gaia genesis, it is also specifying the |
@calvinaco SDK's Coin is flexible -- it will always operate on that highest/fixed precision. |
so I suggest just using "base denomination" as CRO (inputted with a decimal point if needed). |
Oh, but do Reference: https://github.com/cosmos/cosmos-sdk/blob/master/types/coin.go#L622 |
@calvinaco it seems it's always an integer to prevent confusion -- in that case, it's perhaps the easiest just to use SI units (milliCRO, microCRO, nanoCRO). "nanoCRO" won't have a correspondence on Eth, so one visual check is that, in genesis, it should always end with "0" (1 carson = 10 nanoCRO) -- in the case that any amounts in genesis need to be specified with sub-CRO denominations |
it can be done by changing milli, micro, nano will be easy to use |
Oh, how does it work? Because I saw it is in a draft proposal here |
i think, it's given by genesis block. how about adding |
I can try to work on this -- I think setting denominations should just be a matter of registering them e.g. here: https://github.com/crypto-com/chain-main/blob/master/app/prefix.go#L17 |
I can share some of my experiments and findings here: To use the denmo.go, yes I think we just need to call it at app bootstrap. But https://github.com/cosmos/cosmos-sdk/blob/master/types/denom.go#L44 . On the other hand, I tried Either way, they seems to assume always integer arithmetic. For example, let's say we want to say send 1.0000884cro, both the solutions seems won't support it. I could think of two ways, and maybe more:
|
+1 For this approach. Provided BigNumber handling is seamless. |
integer arithmetic is there for determinism (across platforms and architectures) -- we only do integer arithmetic in the old code. |
Oh I see, thanks for the clarification. |
) Solution: - decimal point is something for the future: cosmos/cosmos-sdk#7113 - for the moment -- configured "human" denomination ("cro") + base ("basecro" / "carson") -- configs/tx use "basecro" - custom commands that use "human" denomination and convert it to the base - custom init that changes bond_denom + gov minimum deposit to use the base denomination
) Solution: - decimal point is something for the future: cosmos/cosmos-sdk#7113 - for the moment -- configured "human" denomination ("cro") + base ("basecro" / "carson") -- configs/tx use "basecro" - custom commands that use "human" denomination and convert it to the base - custom init that changes bond_denom + gov minimum deposit to use the base denomination
) Solution: - decimal point is something for the future: cosmos/cosmos-sdk#7113 - for the moment -- configured "human" denomination ("cro") + base ("basecro" / "carson") -- configs/tx use "basecro" - custom commands that use "human" denomination and convert it to the base - custom init that changes bond_denom + gov minimum deposit to use the base denomination
Solution: - adopt the one in chain-main project
Right now we use
Carson
for the name 😂 but ideally we should have a official name for the base unit. This will help to facilitate the communication.The text was updated successfully, but these errors were encountered: