Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fees in community currency #190
Fees in community currency #190
Changes from 1 commit
1da41b4
7ace4ff
ff97003
96d418a
3e6d6e4
3e9d4ec
0d11d41
66571b8
5b126e9
09813ba
4066d19
9869fd2
bfa17db
1c7b6bd
3a97f3b
9e1c30f
7eb4fcb
f672ef3
767064e
a068cda
67c86cb
a4cd038
e92dcc3
86ea1c7
62429fc
fc98120
99efdda
0996eff
15618b5
68a5dec
0ee2477
3074363
dd55a87
f5a9350
7ea9b28
c91ace7
74673ea
1958adb
4338fb1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this. If we have BalanceType U64F64 (typecast from u128) this means one cc is
1 << 64
, not1_000_000_000_000_000_000
This needs more explaining comments, even if the new constants already improve readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pifragile Why did you arbitrarily chose to set ONE_CC=1_000_000_000_000_000_000? I get that you tried to pick a number that avoids overflow, but your choice has nothing to do with the real interpretation of "one CC". We don't need a power of 10, we need the "real" ONE_CC.
Or: why didn't you just set
ONE_CC: u128 = 1 << 64
? Then we could typecast this value to U64F64 and would really get 1 CCThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brenzi the rationale behind this is that i assumed that fungibles uses a system similar to Ethereum where numbers are represented as a large integer (like 256 or 128 bit) and a given amount of decimals.
See here: https://github.com/paritytech/substrate/blob/ded44948e2d5a398abcb4e342b0513cb690961bb/frame/support/src/traits/tokens/fungibles/metadata.rs#L29
So for example with 5 decimals, the number
x
will be represented asx * 10^5
. I chose 18 decimals, hence this number.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but that confirms my concern. We use fixpoint with a base of 2, not base of 10. Unless you can convince me otherwise, I'd like this changed to
ONE_CC: u128 = 1 << 64
throughoutThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only works if no client of the balances pallet ever uses the
decimals
field, because we will obviously not be able to put a value in that field if we use your apporach. i will do some research. what is the reason you would like to change this? to avoid the conversions between base 2 / base 10 numbers?