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

Gas Optimizations #81

Open
code423n4 opened this issue Sep 21, 2022 · 0 comments
Open

Gas Optimizations #81

code423n4 opened this issue Sep 21, 2022 · 0 comments
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

code423n4 commented Sep 21, 2022

  • The check require(amount <= mintableSupply, "INVALID_AMOUNT"); in VariableSupplyERC20Token.mint is unnecessary, because the subtraction on the next line will underflow anyways if this is not true.
  • Decrementing the variable mintableSupply in VariableSupplyERC20Token.mint is not necessary. The remaining mintable supply could always be calculated based on the initialSupply_ (if it would be stored), the maximum supply and the already minted tokens (standard ERC20 variable _totalSupply). The remaining supply is then maxSupply_ - _totalSupply + initialSupply_.
  • In VTVLVesting.sol:353, the loop iteration can be marked as unchecked because an overflow is not possible (as the iterator is bounded) and i++ can be replaced with ++i.
  • Custom errors could be used instead of string error reasons to save gas.
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Sep 21, 2022
code423n4 added a commit that referenced this issue Sep 21, 2022
code423n4 added a commit that referenced this issue Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

1 participant