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

Ether price value and decimal-places of Token #7

Open
bezalel opened this issue Dec 7, 2016 · 4 comments
Open

Ether price value and decimal-places of Token #7

bezalel opened this issue Dec 7, 2016 · 4 comments

Comments

@bezalel
Copy link

bezalel commented Dec 7, 2016

If Token issuer make Token with decimal places 18 (many real tokens such as Golem GNT use same decimal places with Ether, 18), ether prices used in trade should be multiple of 1 ether (1,2,3,4 ether, ... but not 0.1 ether for 1.000000000000000000 Token exchange)

So I suggest ether price in contract code should be "ether price per 1 base unit of target Token"
1 base unit of target token = 1*10^(decimals) tokens (1.000000000000000000 token)

@bezalel
Copy link
Author

bezalel commented Dec 7, 2016

then, MAXNUM value constraint ("use only 128 bits of uint to prevent mul overflows.")
should be reconsidered for integer multiplication and division error.

@o0ragman0o
Copy link
Owner

The base unit is uint 1 and the decimalPlaces is only utilised by the client. It's up to the client to handle the fractional maths. No divisions are used in the contract at all to avoid rounding errors.

@bezalel
Copy link
Author

bezalel commented Dec 7, 2016

But I think safe division can be performed by restricting token amount and ether price parameter.
(restricting that ether price and token aboumt value should have trailing decimal (decimalplaces/2) zeros
for example, If decimal-places is 18, token amount value and ether price value should have 9 trailing decimal zeros..

And I hope decimal places of Token might be fixed to constant(=18) same as Ether.

@o0ragman0o
Copy link
Owner

There's simply no need to use fixed-point maths when you have no divides.

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

2 participants