Open code423n4 opened 2 years ago
calldata
memory
For external function's dynamic params, calldata is the cheapest location to use.
Change params memory to calldata
Custom errors from Solidity 0.8.4 are cheaper than require messages. https://blog.soliditylang.org/2021/04/21/custom-errors/
require
++i
i++
./contracts/UniswapV2PathPriceOracle.sol line: 34 for (uint i = 0; i < path.length - 1; i++) { line: 49 for (uint i = 0; i < path.length - 1; i++) {
++i can save some gas use it like other places in code.
Data location must be "storage" or "memory" for constructor parameter.
Gas Optimizations
Use
calldata
instead ofmemory
:For external function's dynamic params, calldata is the cheapest location to use.
Recommended Mitigation Steps:
Change params
memory
tocalldata
Use Custom Errors to save Gas:
Custom errors from Solidity 0.8.4 are cheaper than
require
messages. https://blog.soliditylang.org/2021/04/21/custom-errors/++i
use less gas thani++
:++i
can save some gas use it like other places in code.