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

API: Decide whether Wad and Ray can hold negative values or not #12

Open
ghost opened this issue Jun 19, 2017 · 4 comments
Open

API: Decide whether Wad and Ray can hold negative values or not #12

ghost opened this issue Jun 19, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 19, 2017

I have used them to hold negative values during calculations in a few places.

This issue is to figure out whether it should stay like that or not.

@nmushegian
Copy link
Contributor

@dbrock

@ghost
Copy link
Author

ghost commented Jun 21, 2017

I know these are always non-negative in Solidity, but it's kind of local to maker.py if we allow them to be negative. For example some arbitrage profitability calculations are performed in Wad and it's perfectly fine for profitability to be negative.

So the question is whether we want to keep Ray and Wad 100% compatible with Solidity types (in terms of sign, overflow etc.) and in that case we need another set of types for things like the aforementioned profitability calculation. Or do we relax these restrictions in the Python code (as it is currently done now).

@rainbreak
Copy link
Contributor

I think you can relax it in client code. Just maybe have a guard around when it goes back into the evm.

@nmushegian
Copy link
Contributor

I would keep Ray and Wad totally compatible and introduce signed versions that are int256 instead of uint128. Require explicit cast before it goes to the evm.

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