sherlock-audit / 2024-08-cork-protocol-judging

2 stars 2 forks source link

Mammoth Laurel Nightingale - state-variable-read-in-a-loop #301

Closed sherlock-admin3 closed 2 months ago

sherlock-admin3 commented 2 months ago

Mammoth Laurel Nightingale

Low/Info

state-variable-read-in-a-loop

Summary

Vulnerability Detail

Impact

Code Snippet

https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/core/assets/AssetFactory.sol#L83 https://github.com/sherlock-audit/2024-08-cork-protocol/blob/main/Depeg-swap/contracts/core/assets/AssetFactory.sol#L87

2024-08-cork-protocol-0xjoichiro/Depeg-swap/contracts/core/assets/AssetFactory.sol

          Replace state variable reads and writes within loops with local variable reads and writes.
          Details: https://sg.run/xADy                                                              

           83┆ Pair storage asset = pairs[i];
            ⋮┆----------------------------------------
           87┆ lv[_idx] = lvs[asset.toId()];

Tool used

Manual Review

Recommendation

sherlock-admin2 commented 1 month ago

The protocol team fixed this issue in the following PRs/commits: https://github.com/Cork-Technology/Depeg-swap/pull/89