Here it is better to replace ">=" with ">" as sending 0 is a waste of gas (similar code is also used in CrossMarginLiquidation):
// send back trader money
if (holdingsValue >= maintainerCut4Account + account.borrowed) {
// send remaining funds back to trader
Fund(fund()).withdraw(
borrowToken,
traderAddress,
holdingsValue - account.borrowed - maintainerCut4Account
);
}
Vulnerability details
Gas optimization suggestion:
Here it is better to replace ">=" with ">" as sending 0 is a waste of gas (similar code is also used in CrossMarginLiquidation): // send back trader money if (holdingsValue >= maintainerCut4Account + account.borrowed) { // send remaining funds back to trader Fund(fund()).withdraw( borrowToken, traderAddress, holdingsValue - account.borrowed - maintainerCut4Account ); }
Eth address
0x523B5b2Cc58A818667C22c862930B141f85d49DD
Handle
paulius.eth
Email address
pauliax6@gmail.com