-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fixed up GaugeReward test #269
Conversation
POOL-2284 Update GaugeRewards contract
|
require(address(_gaugeController) != address(0), "GReward/GC-not-zero-address"); | ||
require(address(_vault) != address(0), "GReward/Vault-not-zero-address"); | ||
require(_stakerCut < 1e9, "GReward/staker-cut-lt-1e9"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a require for _liquidator
different than address zero.
contracts/GaugeReward.sol
Outdated
|
||
gaugeController = _gaugeController; | ||
vault = _vault; | ||
stakerCut = _stakerCut; | ||
liquidator = _liquidator; | ||
|
||
emit Deployed(_gaugeController, _vault); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emit _liquidator
and _stakerCut
in event.
contracts/GaugeReward.sol
Outdated
address(this), | ||
type(uint256).max - _token.allowance(_vaultAddress, address(this)) | ||
); | ||
function afterSwap(IPrizePool prizePool, ITicket ticket, uint256 ticketAmount, IERC20 token, uint256 tokenAmount) external override { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove prizePool
and ticketAmount
params if not used.
type(uint256).max - _token.allowance(_vaultAddress, address(this)) | ||
); | ||
function afterSwap(IPrizePool prizePool, ITicket ticket, uint256 ticketAmount, IERC20 token, uint256 tokenAmount) external override { | ||
require(msg.sender == liquidator, "GReward/only-liquidator"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a modifier instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That code isn't used anywhere else- refactoring it into a modifier doesn't make sense
RewardToken memory _rewardToken = _claimPastRewards(_gauge, _user, _oldStakeBalance); | ||
|
||
_claim(_gauge, _rewardToken.token, _user, _oldStakeBalance, false); | ||
if (_rewardToken.token != IERC20(address(0))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (_rewardToken.token != IERC20(address(0))) { | |
if (address(_rewardToken.token) != address(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean....same difference right?
contracts/GaugeReward.sol
Outdated
_latestRewardToken = _rewardToken; | ||
} | ||
|
||
if (_rewardToken.timestamp > _userLastClaimedTimestamp) { | ||
if (_rewardToken.timestamp > _userLastClaimedTimestamp && _userLastClaimedTimestamp > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for 0
first.
if (_rewardToken.timestamp > _userLastClaimedTimestamp && _userLastClaimedTimestamp > 0) { | |
if (_userLastClaimedTimestamp > 0 && _rewardToken.timestamp > _userLastClaimedTimestamp) { |
|
||
_pushRewardToken(_gauge, _token); | ||
address gauge = address(ticket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty confusing. I still don't understand what the gauge
is referring to in this contract.
Cause here, it means that we add rewards for a ticket and not a gauge?
…er-tests fix(tests): fix GaugeController unit tests
No description provided.