For the result of an external call being written into a storage variable, cache and read from the stack rather than read from the storage variable can save gas.
Instances include:
IERC20Like(collateralAsset).decimals() in DebtLocker.sol#getExpectedAmount() can be cached to avoid an extra external call.
Handle
WatchPug
Vulnerability details
For the result of an external call being written into a storage variable, cache and read from the stack rather than read from the storage variable can save gas.
Instances include:
IERC20Like(collateralAsset).decimals()
inDebtLocker.sol#getExpectedAmount()
can be cached to avoid an extra external call.https://github.com/maple-labs/debt-locker/blob/81f55907db7b23d27e839b9f9f73282184ed4744/contracts/DebtLocker.sol#L237-L253
Recommendation
Change to: