Closed code423n4 closed 2 years ago
ye0lde
Using the existing named returns more efficiently can reduce gas usage and improve code clarity.
These functions have named return variables and don't need explicit return statements at the end.
I suggest deleting the following explicit returns: https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L282 https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L362
Visual Studio Code, Remix
See POC
dupe of #151
Handle
ye0lde
Vulnerability details
Impact
Using the existing named returns more efficiently can reduce gas usage and improve code clarity.
Proof of Concept
These functions have named return variables and don't need explicit return statements at the end.
I suggest deleting the following explicit returns: https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L282 https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/libraries/MathLib.sol#L362
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
See POC