Platform: Code4rena
Start Date: 02/08/2022
Pot Size: $50,000 USDC
Total HM: 12
Participants: 69
Period: 5 days
Judge: gzeon
Total Solo HM: 5
Id: 150
League: ETH
Rank: 69/69
Findings: 1
Award: $39.03
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Dravee
Also found by: 0x040, 0x1f8b, 0xDjango, 0xNazgul, 0xSmartContract, 0xc0ffEE, Aymen0909, Bnke0x0, Chom, CodingNameKiki, Deivitto, Fitraldys, Funen, IllIllI, JC, JohnSmith, NoamYakov, ReyAdmirado, Rolezn, TomJ, Waze, ajtra, bearonbike, bobirichman, brgltd, c3phas, durianSausage, fatherOfBlocks, gogo, ignacio, jag, joestakey, ladboy233, mics, oyc_109, rbserver, samruna, sikorico, simon135
39.0334 USDC - $39.03
There are 4 instances of this issue:
bytes memory params = abi.encode(msg.sender, vaultId, swapData);
bytes memory params = abi.encode(msg.sender, rbData, swapData);
_takeFlashLoan(flData, abi.encode(vaultOwner, autoFee, rbData, swapData));
_takeFlashLoan(flData, abi.encode(vaultsData.vaultOwner(rbData.vaultId), managerFee, rbData, swapData));
Variable owner_ has already been assigned as owner, no need to check later.
address owner_ = owner; // Reserve some gas to ensure that the function has enough to finish the execution. uint256 stipend = gasleft() - minGasReserve; // Delegate call to the target contract. bool success; (success, response) = target.delegatecall{ gas: stipend }(data); // Check that the owner has not been changed. if (owner_ != owner) { revert CustomErrors.OWNER_CHANGED(owner_, owner); }
Recommended Mitigation Steps: Delete the check(L81-L84) to save some gas.