0xProject / 0x-launch-kit-frontend

Apache License 2.0
112 stars 207 forks source link

Token metadata display decimals not work for 0 value #556

Open JoaoCampos89 opened 5 years ago

JoaoCampos89 commented 5 years ago

The new config does not work well when the display decimals value is set to 0 on the tokens config file, which as result will turn back to the default value defined in UI_DECIMALS_DISPLAYED_DEFAULT_PRECISION. When: tokenMetaData.displayDecimals = 0 and UI_DECIMALS_DISPLAYED_DEFAULT_PRECISION = 2 tokenMetaData.displayDecimals || UI_DECIMALS_DISPLAYED_DEFAULT_PRECISION --> this resolves to 2

When the value should be 0 as defined on the config. A possible solution could be:

tokenMetaData.displayDecimals !== undefined ? tokenMetaData.displayDecimals : UI_DECIMALS_DISPLAYED_DEFAULT_PRECISION;

This logic happens on util/token_meta_data.ts