You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
On a high level, we want to make sure that the set of interfaces for a given currency have uniform decimal values. If the decimal is 0, it is possible that 0 is the intended value or simply the decimal value has not been initialized.
We want to be able initially set decimal values.
We want to be able to set decimal value to 0.
We want to ensure uniformity of decimal values across interfaces.
token decimals == 0, but we want to set to 2;
we need check if that is indeed the expected result;
0 == 0 && _decimals == 0;
1 != 2 && 1 > 0
require((_decimals != decimals && _decimals > 0), "Expected decimals to be the same as they are in the storage contract.")
The text was updated successfully, but these errors were encountered:
seanavery
changed the title
RFC: Add check to ensure token decimals being set are the same as any other interface
RFC: Add check to ensure token decimals being set are the same as other interfaces. Check edge condition of intended 0 decimal value.
Jul 23, 2018
https://github.com/tokenio/tokeninc-smart-contracts/blob/45eff8892efb222ba9b21af099f09fea32e044b0/contracts/TokenIOLib.sol#L119
Problem:
On a high level, we want to make sure that the set of interfaces for a given currency have uniform decimal values. If the decimal is 0, it is possible that 0 is the intended value or simply the decimal value has not been initialized.
Example:
USDx, 2
uint _decimals = getUint(...('token.decimals', currency))
0 means it has never been set.
token decimals == 0, but we want to set to 2;
we need check if that is indeed the expected result;
0 == 0 && _decimals == 0;
1 != 2 && 1 > 0
require((_decimals != decimals && _decimals > 0), "Expected decimals to be the same as they are in the storage contract.")
The text was updated successfully, but these errors were encountered: