Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas Optimizations #73

Open
code423n4 opened this issue Apr 27, 2022 · 0 comments
Open

Gas Optimizations #73

code423n4 opened this issue Apr 27, 2022 · 0 comments
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

Comments

@code423n4
Copy link
Contributor

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;
}

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Apr 27, 2022
code423n4 added a commit that referenced this issue Apr 27, 2022
@thomas-waite thomas-waite added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants