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

1 stars 0 forks source link

newIbRatio is not really useful #215

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

It is unclear why you need this new local variable called newIbRatio if you instantly update and use the storage variable afterwards: uint256 newIbRatio = ibRatio * startSupply / totalSupply(); ibRatio = newIbRatio;

Recommended Mitigation Steps

ibRatio = ibRatio * startSupply / totalSupply();

GalloDaSballo commented 2 years ago

Agree with the finding, note that would save only 6 gas (3 for storing in memory, 3 for reading for the copy to storage)