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

Tokens received after LongTermSwap greatly varies from expected values for certain parameters #3

Open
corddry opened this issue Dec 1, 2021 · 2 comments

Comments

@corddry
Copy link

corddry commented Dec 1, 2021

Increasing the length of the long term swaps causes most tests to fail. For example, setting blockInterval to 500 causes the received values to differ from the expected by as much as 30%.

I believe this to be a result of sellingRate being casted to an integer value.
uint256 sellingRate = amount / (orderExpiry - currentBlock);
In cases where amount is close to the number of blocks the order is selling over, this results in a drastic effect.
For example, selling 10,000 tokens over 5,000 blocks results in a sellingRate of 1.977, which is cast to 1, resulting in the user only receiving around half as many tokens as expected.

@corddry

This comment has been minimized.

@corddry
Copy link
Author

corddry commented Dec 14, 2021

This is only an issue for extremely small amounts of tokens, as 10,000 is a tiny fraction of an erc-20 that has say, 18 decimals

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