code-423n4 / 2021-12-yetifinance-findings

0 stars 0 forks source link

Cache storage variables in the stack can save gas #289

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

For the storage variables that will be accessed multiple times, cache them in the stack can save ~100 gas from each extra read (SLOAD after Berlin).

For example: