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 May 7, 2022 · 0 comments
Open

Gas Optimizations #98

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

Comments

@code423n4
Copy link
Contributor

  1. Title : Saving gas by removing = 0

If a variable was not set/initialized, it is assumed to have default value to 0
this implementation was used for saving more gas by removing = 0

##TOOLS USED
Remix, Manual Review

##Mitigation Step
Remove = 0

##Occurances
1. CNft.sol#L49
2. CNft.sol#L97
3. CNft.sol#L119
4. CNft.sol#L175
5. UniswapV2PriceOracle.sol#L41
6. CEther.sol#L178

  1. Title : Using short reason string can be used for saving more gas

Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.

##Tool Used
Manual Review

##Occurances
1. CNft.sol#L24
2. CNft.sol#L25
3. CNft.sol#L52
4. CNft.sol#L100
5. CNft.sol#L124
6. CNft.sol#L148
7. CNft.sol#L208
8. CNft.sol#L209
9. /CNft.sol#L279

  1. Title : change uint256 i = 0 into uint256 i for saving more gas

https://github.com/bunkerfinance/bunker-protocol/blob/752126094691e7457d08fc62a6a5006df59bd2fe/contracts/Oracles/UniswapV2PriceOracle.sol#L42

using this implementation can saving more gas for each loops.

##Tool Used
Manual Review & Remix

##Recommended Mitigation
Change it

  1. Title : Unused SafeTransferFrom() can be removed for saving more gas

since this SafeTransferFrom() function was unused it can be deleted instead for saving more gas cause of recommendation of used safeBatchTransferFrom instead

##Tool Used
Manual Review, Remix

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels May 7, 2022
code423n4 added a commit that referenced this issue May 7, 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