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

0 stars 0 forks source link

Reading from the storage multiple times #106

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

pauliax

Vulnerability details

Impact

There are places where the same storage variable is accessed multiple times in the same function. It would be more gas efficient to cache these variables and re-use them where necessary. E.g. function tokenPrice accesses pools[_token].pairToken 3 times or function _unwrapUniPosition reads from uniPosition[_account] 3 times.

Recommended Mitigation Steps

Extract the value to a temporary variable and re-use it.

talegift commented 3 years ago

This looks more like a tip rather than a specific report. Would be great to have a full list of all occurances.

ghoul-sol commented 3 years ago

incomplete report, invalid