_processWithdrawal Can Be Rewritten To Be More Efficient (PublicSale.sol) #27
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
ye0lde
Vulnerability details
Impact
_processWithdrawal Can Be Rewritten To Be More Efficient (PublicSale.sol)
The "else", the setting of "value to 0", and the return statement can be eliminated to reduce gas and improve code clarity.
Proof of Concept
The _processWithdrawal function is here:
https://github.com/code-423n4/2021-11-bootfinance/blob/7c457b2b5ba6b2c887dafdf7428fd577e405d652/tge/contracts/PublicSale.sol#L212-L229
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
I recommend rewriting it as follows:
function _processWithdrawal (uint _era, uint _day, address _member) private returns (uint value) {
uint memberUnits = mapEraDay_MemberUnits[_era][_day][_member]; // Get Member Units
The text was updated successfully, but these errors were encountered: