This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
46 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
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
6 changes: 3 additions & 3 deletions
6
...tegies/flywheel/FlywheelBorrowBooster.sol → ...s/flywheel/IonicFlywheelBorrowBooster.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
37 changes: 37 additions & 0 deletions
37
contracts/ionic/strategies/flywheel/rewards/IonicFlywheelDynamicRewards.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,37 @@ | ||
|
||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.10; | ||
|
||
import { FlywheelDynamicRewards } from "flywheel-v2/rewards/FlywheelDynamicRewards.sol"; | ||
import { FlywheelCore } from "flywheel-v2/FlywheelCore.sol"; | ||
import { SafeTransferLib, ERC20 } from "solmate/utils/SafeTransferLib.sol"; | ||
|
||
interface ICERC20 { | ||
function plugin() external returns (address); | ||
} | ||
|
||
interface IPlugin { | ||
function claimRewards() external; | ||
} | ||
|
||
contract IonicFlywheelDynamicRewards is FlywheelDynamicRewards { | ||
using SafeTransferLib for ERC20; | ||
|
||
constructor( | ||
FlywheelCore _flywheel, | ||
uint32 _cycleLength | ||
) FlywheelDynamicRewards(_flywheel, _cycleLength) {} | ||
|
||
function getNextCycleRewards(ERC20 strategy) internal override returns (uint192) { | ||
// make it work for both pulled (claimed) and pushed (transferred some other way) rewards | ||
try ICERC20(address(strategy)).plugin() returns (address plugin) { | ||
try IPlugin(plugin).claimRewards() {} catch {} | ||
} catch {} | ||
|
||
uint256 rewardAmount = rewardToken.balanceOf(address(strategy)); | ||
if (rewardAmount != 0) { | ||
rewardToken.safeTransferFrom(address(strategy), address(this), rewardAmount); | ||
} | ||
return uint192(rewardAmount); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
contracts/ionic/strategies/flywheel/rewards/ReplacingFlywheelDynamicRewards.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