Open code423n4 opened 2 years ago
We need to check if delayedProtocolParams
have changed by the Governance
agree with warden here, _lendingPool
return value can be cached once to utilise only a single external call from within _allowTokenIfNecessary
Oh, you mean caching _landingPool
inside this function. Ok, lgtm.
Handle
WatchPug
Vulnerability details
Every call to an external contract costs a decent amount of gas. For optimization of gas usage, external call results should be cached if they are being used for more than one time.
For example:
https://github.com/code-423n4/2021-12-mellow/blob/6679e2dd118b33481ee81ad013ece4ea723327b5/mellow-vaults/contracts/AaveVault.sol#L101-L109
Considering that
_lendingPool()
is a internal call that includes a storage read of_vaultGovernance
and an external call ofIAaveVaultGovernance.delayedProtocolParams()
. Cache the result of_lendingPool()
in the stack can save some gas.Recommendation
Change to: