-
Notifications
You must be signed in to change notification settings - Fork 9
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
[WIP] fix: possible stuck tokens in BribeInitiative #122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,13 @@ import {IGovernance} from "./IGovernance.sol"; | |
|
||
interface IBribeInitiative { | ||
event DepositBribe(address depositor, uint256 boldAmount, uint256 bribeTokenAmount, uint256 epoch); | ||
event RedepositBribe( | ||
address depositor, uint256 boldAmount, uint256 bribeTokenAmount, uint256 originalEpoch, uint256 newEpoch | ||
); | ||
event ModifyLQTYAllocation(address user, uint256 epoch, uint256 lqtyAllocated, uint256 offset); | ||
event ModifyTotalLQTYAllocation(uint256 epoch, uint256 totalLQTYAllocated, uint256 offset); | ||
event ClaimBribe(address user, uint256 epoch, uint256 boldAmount, uint256 bribeTokenAmount); | ||
event ExtractUnclaimableBribe(address recipient, uint256 epoch, uint256 boldAmount, uint256 bribeTokenAmount); | ||
|
||
/// @notice Address of the governance contract | ||
/// @return governance Adress of the governance contract | ||
|
@@ -70,6 +74,14 @@ interface IBribeInitiative { | |
/// @param _epoch Epoch at which the bribe is deposited | ||
function depositBribe(uint256 _boldAmount, uint256 _bribeTokenAmount, uint256 _epoch) external; | ||
|
||
/// @notice Take previously deposited BOLD and/or bribe tokens from an epoch in which nobody voted for the | ||
/// initiative and deposit them as bribes into the current epoch. In case there are no present LQTY | ||
/// allocations, and it's no longer possible to allocate LQTY to the initiative because it's been | ||
/// unregistered, the bribes are paid out to the caller instead. | ||
/// @param _originalEpoch Epoch at which the bribes were originally deposited | ||
/// @param _prevTotalLQTYAllocationEpoch Epoch at which the total allocated LQTY became zero | ||
function redepositBribe(uint256 _originalEpoch, uint256 _prevTotalLQTYAllocationEpoch) external; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would call this something like “recoverOrRedepositBribe”. We may even keep it simple and allow only recovery, and then it would be up to the owner to deposit them again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming it is fine, but I wouldn't let the owner recover bribes, see my other comment. |
||
|
||
struct ClaimData { | ||
// Epoch at which the user wants to claim the bribes | ||
uint256 epoch; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ import {ILQTYStaking} from "./ILQTYStaking.sol"; | |
|
||
import {PermitParams} from "../utils/Types.sol"; | ||
|
||
uint256 constant UNREGISTERED_INITIATIVE = type(uint256).max; | ||
|
||
interface IGovernance { | ||
/// @notice Emitted when a user deposits LQTY | ||
/// @param user The account depositing LQTY | ||
|
@@ -216,7 +218,9 @@ interface IGovernance { | |
|
||
/// @notice Returns when an initiative was registered | ||
/// @param _initiative Address of the initiative | ||
/// @return atEpoch Epoch at which the initiative was registered | ||
/// @return atEpoch If `_initiative` is an active initiative, returns the epoch at which it was registered. | ||
/// If `_initiative` hasn't been registered, returns 0. | ||
/// If `_initiative` has been unregistered, returns `UNREGISTERED_INITIATIVE`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 |
||
function registeredInitiatives(address _initiative) external view returns (uint256 atEpoch); | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
|
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.
Where are we validating that sender is the owner?
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.
We are intentionally letting anyone recover the bribes. Since anyone could have deposited those bribes, it doesn't feel right to only let the owner (who's not known currently, since BribeInitiative isn't Ownable) claim them. I expect the bribes to be extracted as MEV in this case.
If you as a bribe depositor couldn't even be bothered to allocate a single wei of LQTY to prevent the bribes from getting stuck in the first place, then you don't deserve to reclaim them.
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.
So this means that in the case of 0 LQTY votes, we're going from "no one can claim/redeposit" to "anyone can redeposit"? And in both cases, the issue is fully mitigated by the bribe depositor allocating 1 wei LQTY, right?
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.
In case there are no votes in the original epoch in which the bribes were deposited (hence why the're stuck), and the current epoch has no votes either, and the initiative has been disabled then yes, anyone can claim the stuck bribes.
Normally, they would just be moved to the current epoch, where people would be able to vote to see who gets how much. But this is no longer possible if the initiative has been disabled.