The function _depositToAave of ATokenYieldSource calls _lendingPool and _tokenAddress twice, both of which include function calls to external contracts. Thus, storing the first results into local variables and reuse them for the second time could help save gas.
Handle
shw
Vulnerability details
Impact
The function
_depositToAave
ofATokenYieldSource
calls_lendingPool
and_tokenAddress
twice, both of which include function calls to external contracts. Thus, storing the first results into local variables and reuse them for the second time could help save gas.Proof of Concept
Referenced code: ATokenYieldSource.sol#L175-L182
Recommended Mitigation Steps
Store the result of
_tokenAddress()
and_lendingPool()
to local variables and resue them.