Closed code423n4 closed 2 years ago
ye0lde
Removing unused named return variables and local variables can reduce gas usage and improve code clarity.
calcMint, calcMintWithRen, calcMintWithWbtc Unused named returns https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L156
Unused local variables https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L178-L179 https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L197-L198
calcRedeem, calcRedeemInRen, calcRedeemInWbtc Unused named returns https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L251
Unused local variables https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L274-L275 https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L295-L296
Visual Studio Code, Remix
Remove the unused named returns and local variables
Agree, we should just removed the named returns
duplicate of #39
Handle
ye0lde
Vulnerability details
Impact
Removing unused named return variables and local variables can reduce gas usage and improve code clarity.
Proof of Concept
calcMint, calcMintWithRen, calcMintWithWbtc Unused named returns https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L156
Unused local variables https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L178-L179 https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L197-L198
calcRedeem, calcRedeemInRen, calcRedeemInWbtc Unused named returns https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L251
Unused local variables https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L274-L275 https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L295-L296
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
Remove the unused named returns and local variables