Open code423n4 opened 2 years ago
pauliax
Result of this.totalSupply() could be cached to avoid duplicate calls:
require(this.totalSupply() > 0, "Exchange: INSUFFICIENT_LIQUIDITY"); ... uint256 totalSupplyOfLiquidityTokens = this.totalSupply();
Caching totalSupply to memory will yield gas savings. Reading from Storage costs 100 (after first hot read (2.1k)) Reading from memory costs only 3
Agree with finding
Handle
pauliax
Vulnerability details
Impact
Result of this.totalSupply() could be cached to avoid duplicate calls: