-
Notifications
You must be signed in to change notification settings - Fork 4
How to format amounts
Dmitry Bespalov edited this page Aug 3, 2021
·
13 revisions
This doc specifies the different types of formatting amounts inside the Safe apps.
Used when the entire amount matters.
- No truncation, always show all numbers.
- Thousands and decimal separators are used according to user's locale.
Used in cases where horizontal screen real estate is limited and the complete amount is not super important.
- Cut off after the 5th decimal, no matter how many decimals there are: 0.12345
- Remove trailing zeroes, i.e. display
0.10000
as0.1
- Use the 5 decimals up until
999.99999
- Use 1 decimal less from
1,000.0001
until9,999.9999
(Use comma as thousands-separator) - Use 1 decimal less from
10,000.001
until99,999.999
- Use 1 decimal less from
100,000.01
until999,999.99
- Use 1 decimal less from
1,000,000.1
until9,999,999.9
- From
10,000,000
No Decimals until99,999,999
- Then Use
100.001M
until999.999M
- Then
1.001B
until999.999B
- Then
1.001T
until999T
- Then just
>999T
- Thousands and decimal separators are used according to user's locale.
- M, B, T should be localized.
- (Edit June 19) For amounts smaller then 0.00001, display
<0.00001
(Otherwise it would show as0.00000
which is weird since the balance is actually >0. - (Edit September 8) When there is a +/- prefix to the amount (e.g.
+0.00001
or-0.00001
) and the Eucledian distance of the amount is smaller than 0.00001, then use< -0.00001
and< +0.00001
despite the fact that it's semantically not 100% correct as e.g. -0.0000005 is bigger, not smaller than -0.00001. (cf. discussion on Slack)
This format has been discussed on a Github issue
If possible, the same rules from above apply to fiat numbers as well. Make sure to use the right amount of numbers after the decimal separator, maximum, respective to the respective fiat currency (i.e. maximum 2 for USD).
It is acceptable to use the operating system's formatter.