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

Address #904 #2

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/erc-20/ERC20Boost.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ abstract contract ERC20Boost is ERC20, Ownable, IERC20Boost {

/// @inheritdoc IERC20Boost
function detach(address user) external {
require(_userGauges[user].remove(msg.sender));
require(_userGauges[user].remove(msg.sender)); // Remove from set. Should never fail.
delete getUserGaugeBoost[user][msg.sender];

emit Detach(user, msg.sender);
Expand Down Expand Up @@ -174,8 +174,8 @@ abstract contract ERC20Boost is ERC20, Ownable, IERC20Boost {
/// @inheritdoc IERC20Boost
function decrementGaugeBoost(address gauge, uint256 boost) public {
GaugeState storage gaugeState = getUserGaugeBoost[msg.sender][gauge];
if (boost >= gaugeState.userGaugeBoost) {
_userGauges[msg.sender].remove(gauge);
if (_deprecatedGauges.contains(gauge) || boost >= gaugeState.userGaugeBoost) {
require(_userGauges[msg.sender].remove(gauge)); // Remove from set. Should never fail.
delete getUserGaugeBoost[msg.sender][gauge];

emit Detach(msg.sender, gauge);
Expand All @@ -188,7 +188,7 @@ abstract contract ERC20Boost is ERC20, Ownable, IERC20Boost {

/// @inheritdoc IERC20Boost
function decrementGaugeAllBoost(address gauge) external {
require(_userGauges[msg.sender].remove(gauge));
require(_userGauges[msg.sender].remove(gauge)); // Remove from set. Should never fail.
delete getUserGaugeBoost[msg.sender][gauge];

emit Detach(msg.sender, gauge);
Expand Down