We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; uint256 public queuedRewards = 0; uint256 public currentRewards = 0; uint256 public historicalRewards = 0;
proposed change:
uint256 public periodFinish; uint256 public rewardRate; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; uint256 public queuedRewards; uint256 public currentRewards; uint256 public historicalRewards;
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L66-L72
for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).stake(msg.sender, _amount); }
uint extraRewardsLength = extraRewards.length; for (uint256 i; i < extraRewardsLength;) { IRewards(extraRewards[i]).stake(msg.sender, _amount); unchecked { ++i;} }
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L176-L178
for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).getReward(_account); }
uint extraRewardsLength = extraRewards.length; for (uint256 i; i < extraRewardsLength;) { IRewards(extraRewards[i]).getReward(_account); unchecked { ++i;} }
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L282-L283
for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); }
uint extraRewardsLength = extraRewards.length; for (uint256 i; i < extraRewardsLength;) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); unchecked { ++i;} }
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L245-L247
uint extraRewardsLength = extraRewards.length; for (uint256 i ; i < extraRewardslength;) { IRewards(extraRewards[i]).withdraw(msg.sender, amount); unchecked {++i;} }
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L218-L221
for (uint256 i = 0; i < extraRewards.length; i++) { IRewards(extraRewards[i]).stake(_for, _amount); }
uint extraRewardsLength = extraRewards.length; for (uint256 i; i < extraRewardsLength;) { IRewards(extraRewards[i]).stake(_for, _amount); unchecked { ++i;} }
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L199-L201
require(_amount > 0, "RewardPool : Cannot stake 0");
require(_amount != 0, "RewardPool : Cannot stake 0");
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L196
require(amount > 0, "RewardPool : Cannot withdraw 0");
require(amount != 0, "RewardPool : Cannot withdraw 0");
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L215
The text was updated successfully, but these errors were encountered:
Cityscape issue #178
d7b6ffb
Less than 500 gas saved
Sorry, something went wrong.
No branches or pull requests
Gas Optimizations
Unnecessarily initialized variable
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L66-L72
Loop optimizations
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L176-L178
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L282-L283
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L245-L247
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L218-L221
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L199-L201
≠ 0 is cheaper than > 0 in require statements
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L196
proposed change:
https://github.com/code-423n4/2022-05-vetoken/blob/2d7cd1f6780a9bcc8387dea8fecfbd758462c152/contracts/BaseRewardPool.sol#L215
The text was updated successfully, but these errors were encountered: