Skip to content

feat: clearer error message for arithmetic underflow #42

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neutiyoo
Copy link

@neutiyoo neutiyoo commented Jan 8, 2025

This pull request includes several changes to the FERC20 contract to improve the handling of balances and allowances. The most important changes include adding balance and allowance checks, and using unchecked arithmetic operations to optimize gas usage.

Improvements to balance and allowance handling:

  • Added a check to ensure the sender's allowance is sufficient before transferring tokens in the transferFrom function. (contracts/fun/FERC20.sol)
  • Added a check to ensure the sender's balance is sufficient before transferring tokens in the _transfer function. (contracts/fun/FERC20.sol)
  • Added a check to ensure the user's balance is sufficient before burning tokens in the _burn and burnFrom functions. (contracts/fun/FERC20.sol)

Optimizations:

  • Used unchecked arithmetic operations in the _transfer and _burn functions to save gas. (contracts/fun/FERC20.sol) [1] [2]

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.

1 participant