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

Low severity #9

Merged
merged 4 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion contracts/GaugeExtraRewarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,19 @@ contract GaugeExtraRewarder is Ownable {
function recoverERC20(uint amount, address token) external onlyOwner {
require(amount > 0, "amount > 0");
require(token != address(0), "addr0");
require(IERC20(token).balanceOf(address(this)) >= amount, "not enough");
uint balance = IERC20(token).balanceOf(address(this));
require(balance >= amount, "not enough tokens");

// if token is = reward and there are some (rps > 0), allow withdraw only for remaining rewards and then set new rewPerSec
if(token == address(rewardToken) && rewardPerSecond != 0){
updatePool();
uint timeleft = lastDistributedTime - block.timestamp;
uint notDistributed = rewardPerSecond * timeleft;
require(amount <= notDistributed, 'too many rewardToken');
rewardPerSecond = (balance - amount) / timeleft;
}
IERC20(token).safeTransfer(msg.sender, amount);

}


Expand Down
5 changes: 3 additions & 2 deletions contracts/VoterV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,9 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
uint256 _usedWeight = 0;
uint256 _time = _epochTimestamp();

for (uint256 i = 0; i < _poolCnt; i++) {
_totalVoteWeight += _weights[i];

for (uint i = 0; i < _poolCnt; i++) {
if(isAlive[gauges[_poolVote[i]]]) _totalVoteWeight += _weights[i];
}

for (uint256 i = 0; i < _poolCnt; i++) {
Expand Down