sherlock-audit / 2023-01-uxd-judging

3 stars 1 forks source link

zaevlad - Gas cost in array #399

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

zaevlad

informational

Gas cost in array

Summary

Gas cost in array.

Vulnerability Detail

Make the variable (byAsset.length) outside the loop to save gas.

Impact

Addiditonal gas cost in function implementation.

Code Snippet

https://github.com/sherlock-audit/2023-01-uxd/blob/main/contracts/core/UXDRouter.sol#L115

Tool used

Manual Review

Recommendation

uint265 arr = byAsset.length;