Underutilized Named Returns #77
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
ye0lde
Vulnerability details
Impact
Using the existing named returns more efficiently can reduce gas usage and improve code clarity.
Proof of Concept
Use the existing named returns more efficiently:
Change line 91 to
collateralReserves = maltReserves.mul(price).div(priceTarget);
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/MaltDataLab.sol#L91
Delete the return at line #234
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/RewardSystem/RewardDistributor.sol#L234
I suggest changing requestCapital from
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/RewardSystem/RewardOverflowPool.sol#L39-L62
to
I suggest changing outstandingArbTokens from
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionParticipant.sol#L104-L117
to
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
See POC
The text was updated successfully, but these errors were encountered: