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

1 stars 0 forks source link

Isolated margin contracts declare but do not set the value of liquidationThresholdPercent #40

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Email address

pauliax6@gmail.com

Handle

paulius.eth

Eth address

0x523B5b2Cc58A818667C22c862930B141f85d49DD

Vulnerability details

CrossMarginTrading sets value of liquidationThresholdPercent in the constructor: liquidationThresholdPercent = 110; Isolated margin contracts declare but do not set the value of liquidationThresholdPercent.

Recommended mitigation steps

Set the initial value for the liquidationThresholdPercent in Isolated margin contracts.

Impact

This makes function belowMaintenanceThreshold to always return true unless a value is set via function setLiquidationThresholdPercent. Comments indicate that the value should also be set to 110:

// The following should hold: // holdings / loan >= 1.1 // => holdings >= loan * 1.1