This repository was archived by the owner on Jun 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
How to format amounts
Dmitry Bespalov edited this page Dec 9, 2020
·
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.10000as0.1 - Use the 5 decimals up until
999.99999 - Use 1 decimal less from
1,000.0001until9,999.9999(Use comma as thousands-separator) - Use 1 decimal less from
10,000.001until99,999.999 - Use 1 decimal less from
100,000.01until999,999.99 - Use 1 decimal less from
1,000,000.1until9,999,999.9 - From
10,000,000No Decimals until99,999,999 - Then Use
10.001Muntil999.999M - Then
1.001Buntil999.999B - Then
1.001Tuntil999T - 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.00000which is weird since the balance is actually >0. - (Edit September 8) When there is a +/- prefix to the amount (e.g.
+0.00001or-0.00001) and the Eucledian distance of the amount is smaller than 0.00001, then use< -0.00001and< +0.00001despite 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.