Skip to content
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

RFC: Add check to ensure token decimals being set are the same as other interfaces. Check edge condition of intended 0 decimal value. #30

Open
seanavery opened this issue Jul 23, 2018 · 0 comments

Comments

@seanavery
Copy link
Contributor

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.

  1. We want to be able initially set decimal values.
  2. We want to be able to set decimal value to 0.
  3. We want to ensure uniformity of decimal values across interfaces.

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.")

@seanavery 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant