You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,35 +11,21 @@ import {IFlywheelBooster} from "./interfaces/IFlywheelBooster.sol";
11
11
/**
12
12
@title Flywheel Core Incentives Manager
13
13
@notice Flywheel is a general framework for managing token incentives.
14
-
It is comprised of the Core (this contract), Rewards module, and optional Booster module.
14
+
It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.
15
15
16
-
Core is responsible for maintaining reward accrual through reward indexes.
17
-
It delegates the actual accrual logic to the Rewards Module.
16
+
The Core contract maintaings three important pieces of state:
17
+
* the rewards index which determines how many rewards are owed per token per strategy. User indexes track how far behind the strategy they are to lazily calculate all catch-up rewards.
18
+
* the accrued (unclaimed) rewards per user.
19
+
* references to the booster and rewards module described below.
18
20
19
-
For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
21
+
Core does not manage any tokens directly. The rewards module maintains token balances, and approves core to pull transfer them to users when they claim.
22
+
23
+
SECURITY NOTE: For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
20
24
Accrue should be called any time tokens are transferred, minted, or burned.
Copy file name to clipboardExpand all lines: src/interfaces/IFlywheelBooster.sol
+22-3Lines changed: 22 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,31 @@ import {ERC20} from "solmate/tokens/ERC20.sol";
5
5
6
6
/**
7
7
@title Balance Booster Module for Flywheel
8
-
@notice An optional module for virtually boosting user balances. This allows a Flywheel Core to plug into some balance boosting logic.
8
+
@notice Flywheel is a general framework for managing token incentives.
9
+
It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.
9
10
10
-
Boosting logic can be associated with referrals, vote-escrow, or other strategies. It can even be used to model exotic strategies like borrowing.
11
-
*/
11
+
The Booster module is an optional module for virtually boosting or otherwise transforming user balances.
12
+
If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.
13
+
14
+
Boosting logic can be associated with referrals, vote-escrow, or other strategies.
15
+
16
+
SECURITY NOTE: similar to how Core needs to be notified any time the strategy user composition changes, the booster would need to be notified of any conditions which change the boosted balances atomically.
17
+
This prevents gaming of the reward calculation function by using manipulated balances when accruing.
18
+
*/
12
19
interfaceIFlywheelBooster {
20
+
21
+
/**
22
+
@notice calculate the boosted supply of a strategy.
23
+
@param strategy the strategy to calculate boosted supply of
24
+
@return the boosted supply
25
+
*/
13
26
function boostedTotalSupply(ERC20strategy) externalviewreturns(uint256);
14
27
28
+
/**
29
+
@notice calculate the boosted balance of a user in a given strategy.
30
+
@param strategy the strategy to calculate boosted balance of
31
+
@param user the user to calculate boosted balance of
32
+
@return the boosted balance
33
+
*/
15
34
function boostedBalanceOf(ERC20strategy, addressuser) externalviewreturns(uint256);
0 commit comments