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

feat: ensure minimal fee is more than 0 #17

Merged
merged 1 commit into from
Apr 13, 2024
Merged

feat: ensure minimal fee is more than 0 #17

merged 1 commit into from
Apr 13, 2024

Conversation

raventid
Copy link
Contributor

The calculate_fees method calculates the fee based on a percentage of the transaction amount. However, due to the use of integer division, any calculation that results in a value between 0 and 1 will be rounded down to 0. This means that for small amounts of the transaction, the calculated fee can be zero, effectively bypassing the intended fee mechanism. This issue primarily affects transactions involving small quantities of tokens, where the fee, although nominally applicable, is nullified by the rounding behavior of integer arithmetic.

This PR proposes the next solution. When we detect that fee is computed to 0 we just increase it to 1 .

@raventid raventid requested a review from aleksuss April 12, 2024 13:31
@aleksuss aleksuss merged commit 5893411 into main Apr 13, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants