-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #764 from fei-protocol/release/2.8.0
Release/2.8.0
- Loading branch information
Showing
39 changed files
with
3,370 additions
and
180 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import "./SnapshotDelegatorPCVDeposit.sol"; | ||
import "./utils/VoteEscrowTokenManager.sol"; | ||
import "./utils/LiquidityGaugeManager.sol"; | ||
import "./utils/GovernorVoter.sol"; | ||
|
||
/// @title 80-BAL-20-WETH BPT PCV Deposit | ||
/// @author Fei Protocol | ||
contract VeBalDelegatorPCVDeposit is | ||
SnapshotDelegatorPCVDeposit, | ||
VoteEscrowTokenManager, | ||
LiquidityGaugeManager, | ||
GovernorVoter | ||
{ | ||
address public constant B_80BAL_20WETH = | ||
0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56; | ||
address public constant VE_BAL = 0xC128a9954e6c874eA3d62ce62B468bA073093F25; | ||
address public constant BALANCER_GAUGE_CONTROLLER = | ||
0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD; | ||
|
||
/// @notice veBAL token manager | ||
/// @param _core Fei Core for reference | ||
/// @param _initialDelegate initial delegate for snapshot votes | ||
constructor(address _core, address _initialDelegate) | ||
SnapshotDelegatorPCVDeposit( | ||
_core, | ||
IERC20(B_80BAL_20WETH), // token used in reporting | ||
"balancer.eth", // initial snapshot spaceId | ||
_initialDelegate | ||
) | ||
VoteEscrowTokenManager( | ||
IERC20(B_80BAL_20WETH), // liquid token | ||
IVeToken(VE_BAL), // vote-escrowed token | ||
365 * 86400 // vote-escrow time = 1 year | ||
) | ||
LiquidityGaugeManager(BALANCER_GAUGE_CONTROLLER) | ||
GovernorVoter() | ||
{} | ||
|
||
/// @notice returns total balance of PCV in the Deposit | ||
function balance() public view override returns (uint256) { | ||
return _totalTokensManaged(); // liquid and vote-escrowed tokens | ||
} | ||
} |
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
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,9 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.4; | ||
|
||
import "./MockCoreRef.sol"; | ||
import "../metagov/utils/GovernorVoter.sol"; | ||
|
||
contract MockGovernorVoter is GovernorVoter, MockCoreRef { | ||
constructor(address core) MockCoreRef(core) GovernorVoter() {} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.10; | ||
|
||
import "../../metagov/utils/LiquidityGaugeManager.sol"; | ||
import "../IPCVDepositBalances.sol"; | ||
|
||
/// @title AngleGaugeLens | ||
/// @author Fei Protocol | ||
/// @notice a contract to read tokens held in a gauge. | ||
/// Angle has a small modification in their Curve fork : they name a | ||
/// variable staking_token() instead of lp_token() as in the original Curve code. | ||
contract AngleGaugeLens is IPCVDepositBalances { | ||
/// @notice FEI token address | ||
address private constant FEI = 0x956F47F50A910163D8BF957Cf5846D573E7f87CA; | ||
|
||
/// @notice the gauge inspected | ||
address public immutable gaugeAddress; | ||
|
||
/// @notice the address of the contract staking in the gauge | ||
address public immutable stakerAddress; | ||
|
||
/// @notice the token the lens reports balances in | ||
address public immutable override balanceReportedIn; | ||
|
||
constructor(address _gaugeAddress, address _stakerAddress) { | ||
gaugeAddress = _gaugeAddress; | ||
stakerAddress = _stakerAddress; | ||
balanceReportedIn = ILiquidityGauge(_gaugeAddress).staking_token(); | ||
} | ||
|
||
/// @notice returns the amount of tokens staked by stakerAddress in | ||
/// the gauge gaugeAddress. | ||
function balance() public view override returns (uint256) { | ||
return ILiquidityGauge(gaugeAddress).balanceOf(stakerAddress); | ||
} | ||
|
||
/// @notice returns the amount of tokens staked by stakerAddress in | ||
/// the gauge gaugeAddress. | ||
/// In the case where an LP token between XYZ and FEI is staked in | ||
/// the gauge, this lens reports the amount of LP tokens staked, not the | ||
/// underlying amounts of XYZ and FEI tokens held within the LP tokens. | ||
/// This lens can be coupled with another lens in order to compute the | ||
/// underlying amounts of FEI and XYZ held inside the LP tokens. | ||
function resistantBalanceAndFei() | ||
public | ||
view | ||
override | ||
returns (uint256, uint256) | ||
{ | ||
uint256 stakedBalance = balance(); | ||
if (balanceReportedIn == FEI) { | ||
return (stakedBalance, stakedBalance); | ||
} else { | ||
return (stakedBalance, 0); | ||
} | ||
} | ||
} |
Oops, something went wrong.