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

specify balances in state in big number string so it can handle larger amount #31

Open
swswsw opened this issue Sep 14, 2018 · 0 comments

Comments

@swswsw
Copy link
Owner

swswsw commented Sep 14, 2018

balances in state is currently a js number. it has limitation on how large the number can be.
we cannot store js BigNumber in state, doing so cause various problems.
so we should store the number as string in the state.
everytime we use it, we should remember to convert it to bignumber.
evertime we store balance in state, we should remember to convert it to string representation.

allow user to use string to specify amount in input so big number can be used.

eg.

curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": 10, "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'

change the amount to string.

curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": "2000000000000", "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'

everytime we read the amount, we should use
let amount = new BigNumber(inputAmount);
to make sure we convert it to bignumber.

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