-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.0.0' into usds-plugin
- Loading branch information
Showing
65 changed files
with
2,664 additions
and
317 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
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
49 changes: 49 additions & 0 deletions
49
contracts/plugins/assets/aerodrome/AerodromeGaugeWrapper.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,49 @@ | ||
// SPDX-License-Identifier: BlueOak-1.0.0 | ||
pragma solidity ^0.8.19; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "../erc20/RewardableERC20Wrapper.sol"; | ||
import "./vendor/IAeroGauge.sol"; | ||
|
||
// Note: Only supports AERO rewards. | ||
contract AerodromeGaugeWrapper is RewardableERC20Wrapper { | ||
using SafeERC20 for IERC20; | ||
|
||
IAeroGauge public immutable gauge; | ||
|
||
/// @param _lpToken The Aerodrome LP token, transferrable | ||
constructor( | ||
ERC20 _lpToken, | ||
string memory _name, | ||
string memory _symbol, | ||
ERC20 _aero, | ||
IAeroGauge _gauge | ||
) RewardableERC20Wrapper(_lpToken, _name, _symbol, _aero) { | ||
require( | ||
address(_aero) != address(0) && | ||
address(_gauge) != address(0) && | ||
address(_lpToken) != address(0), | ||
"invalid address" | ||
); | ||
|
||
require(address(_aero) == address(_gauge.rewardToken()), "wrong Aero"); | ||
|
||
gauge = _gauge; | ||
} | ||
|
||
// deposit an Aerodrome LP token | ||
function _afterDeposit(uint256 _amount, address) internal override { | ||
underlying.approve(address(gauge), _amount); | ||
gauge.deposit(_amount); | ||
} | ||
|
||
// withdraw to Aerodrome LP token | ||
function _beforeWithdraw(uint256 _amount, address) internal override { | ||
gauge.withdraw(_amount); | ||
} | ||
|
||
// claim rewards - only supports AERO rewards | ||
function _claimAssetRewards() internal virtual override { | ||
gauge.getReward(address(this)); | ||
} | ||
} |
Oops, something went wrong.