Gas Optimizations #73
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Gas
Check whether there's any rewards before storing these state variables : storedAsset and lastReward
https://github.com/fei-protocol/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L87
I mentioned to the dev(Joey|Tribe) that newReward will be zero since whatever asset is deposited in the contract would equal to the storedAsset - lastReward(zero if newReward is zero) .He responded that the donations would come directly from the protocol. But since the frequency of such deposits can't be ascertained, it's counterproductive to be saving a zero value to storage (in the event that there are no rewards for users).
Update the state variable as such :
if(newReward≠0){
storedTotalAssets=storedTotalAssets_+lastRewardAmount_;
lastReward=newReward;
}
The text was updated successfully, but these errors were encountered: