-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add FeeDistributorBALClaimer contract
- Loading branch information
1 parent
afb4fd5
commit 4b9e0be
Showing
8 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
pkg/liquidity-mining/contracts/fee-distribution/FeeDistributorBALClaimer.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
pragma solidity ^0.7.0; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "@balancer-labs/v2-standalone-utils/contracts/interfaces/IBALTokenHolder.sol"; | ||
|
||
import "../interfaces/IFeeDistributor.sol"; | ||
import "../interfaces/ISingleRecipientLiquidityGauge.sol"; | ||
|
||
/** | ||
* @title FeeDistributorBALClaimer | ||
* @notice Atomically mints any outstanding BAL from a SingleRecipientGauge and transfers it to the FeeDistributor | ||
* in order for it to be distributed among veBAL holders. | ||
*/ | ||
contract FeeDistributorBALClaimer { | ||
IERC20 private immutable _balToken; | ||
IFeeDistributor private immutable _feeDistributor; | ||
ISingleRecipientLiquidityGauge private immutable _gauge; | ||
IBALTokenHolder private immutable _balTokenHolder; | ||
|
||
constructor(IFeeDistributor feeDistributor, ISingleRecipientLiquidityGauge gauge) { | ||
IBALTokenHolder balTokenHolder = IBALTokenHolder(gauge.getRecipient()); | ||
|
||
_balToken = balTokenHolder.getBalancerToken(); | ||
_feeDistributor = feeDistributor; | ||
_gauge = gauge; | ||
_balTokenHolder = balTokenHolder; | ||
} | ||
|
||
/** | ||
* @notice Mint any outstanding BAL emissions and send them to the FeeDistributor | ||
*/ | ||
function distributeBAL() external { | ||
_gauge.checkpoint(); | ||
_balTokenHolder.withdrawFunds(address(_feeDistributor), _balToken.balanceOf(address(_balTokenHolder))); | ||
_feeDistributor.checkpointToken(_balToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
pkg/liquidity-mining/contracts/interfaces/IStakelessGauge.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
pragma solidity ^0.7.0; | ||
|
||
import "./ILiquidityGauge.sol"; | ||
|
||
interface IStakelessGauge is ILiquidityGauge { | ||
function checkpoint() external payable returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters