code-423n4 / 2021-04-marginswap-findings

1 stars 0 forks source link

[Gas] same calculations are done twice #55

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Vulnerability details

Gas optimization suggestion:

contract CrossMarginLiquidation, here the same calculations are done twice: (peg2targetCost * (100 + MAINTAINER_CUT_PERCENT)) / 100 it would be better to extract it into a variable and use it instead. Same here: emit LiquidationShortfall(liquidationTarget - liquidationReturns); Lending(lending()).haircut(liquidationTarget - liquidationReturns);

Email address

pauliax6@gmail.com

Handle

paulius.eth

Eth address

0x523B5b2Cc58A818667C22c862930B141f85d49DD