code-423n4 / 2021-09-defiprotocol-findings

1 stars 0 forks source link

Eliminate hasBonded #216

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

You can get rid of hasBonded state variable if you treat bondTimestamp with a value of 0 as not bonded. This would save some gas.

Recommended Mitigation Steps

E.g.: replace require(!hasBonded); with require(bondTimestamp == 0); and hasBonded = false; with bondTimestamp = 0;

GalloDaSballo commented 2 years ago

Agree that you can remove the boolean hasBonded by giving a special meaning to the value 0 for bondTimestamp