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 #98

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

Gas Optimizations #98

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

Comments

@code423n4
Copy link
Contributor

Gas1: prefer fixing pragma instead of floating pragma

Gas2: break && into seperate statements for require() save gas

chainlinkpriceoracle.md - l#86
ManagedIndexReweightingLogic.sol - l#29-32

Gas3: prefer uint256 instead of other uint types

BaseIndex.sol - l#77
IndexLibrary.sol - l#14,17,26
TopNMarketCapIndex.sol - l#8

Gas4: For unsigned integer, no need to check >, instead check for !=, which save gas

IndexLibrary.sol l#29 (_assetPerBaseInUQ)
IndexLogic.sol - l#98 (value)

Gas5: use prefix {++i}

UniswapV2PricePathOracle.sol -
It don't follow prefix optimisations for loops, It should also use prefix ++i instead of i++ to save gas as other

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Apr 21, 2022
code423n4 added a commit that referenced this issue Apr 21, 2022
@jn-lp jn-lp added the duplicate This issue or pull request already exists label May 3, 2022
@jn-lp jn-lp closed this as completed May 3, 2022
@itsmetechjay itsmetechjay reopened this May 13, 2022
@liveactionllama liveactionllama removed the duplicate This issue or pull request already exists label May 17, 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

4 participants