code-423n4 / 2021-10-tally-findings

0 stars 0 forks source link

Unnecessary `SLOAD` in `Swap.setSwapFee()` #63

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pants

Vulnerability details

This line in Swap.setSwapFee() perfoms an SLOAD operation for a value that is already stored in a local variable:

emit NewSwapFee(swapFee);

Impact

Storage reads are much more expensive than reading local variables.

Tool Used

Manual code review.

Recommended Mitigation Steps

Use the already existing local variable instead of loading this value from storage:

emit NewSwapFee(swapFee_);