Skip to content

Commit

Permalink
Merge pull request #68 from kphed/update-version-pragma
Browse files Browse the repository at this point in the history
Enable compiler versions 0.8.10 and up to be selected
  • Loading branch information
Joeysantoro authored Nov 3, 2023
2 parents 5ac5d31 + 3ff43d5 commit ba00148
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 34 deletions.
20 changes: 10 additions & 10 deletions src/FlywheelCore.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {Auth, Authority} from "solmate/auth/Auth.sol";
Expand All @@ -21,7 +21,7 @@ import {IFlywheelBooster} from "./interfaces/IFlywheelBooster.sol";
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.
SECURITY NOTE: For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
SECURITY NOTE: For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
Accrue should be called any time tokens are transferred, minted, or burned.
*/
contract FlywheelCore is Auth {
Expand Down Expand Up @@ -56,7 +56,7 @@ contract FlywheelCore is Auth {
ACCRUE/CLAIM LOGIC
//////////////////////////////////////////////////////////////*/

/**
/**
@notice Emitted when a user's rewards accrue to a given strategy.
@param strategy the updated rewards strategy
@param user the user of the rewards
Expand All @@ -65,7 +65,7 @@ contract FlywheelCore is Auth {
*/
event AccrueRewards(ERC20 indexed strategy, address indexed user, uint256 rewardsDelta, uint256 rewardsIndex);

/**
/**
@notice Emitted when a user claims accrued rewards.
@param user the user of the rewards
@param amount the amount of rewards claimed
Expand All @@ -75,7 +75,7 @@ contract FlywheelCore is Auth {
/// @notice The accrued but not yet transferred rewards for each user
mapping(address => uint256) public rewardsAccrued;

/**
/**
@notice accrue rewards for a single user on a strategy
@param strategy the strategy to accrue a user's rewards on
@param user the user to be accrued
Expand All @@ -90,7 +90,7 @@ contract FlywheelCore is Auth {
return accrueUser(strategy, user, state);
}

/**
/**
@notice accrue rewards for a two users on a strategy
@param strategy the strategy to accrue a user's rewards on
@param user the first user to be accrued
Expand All @@ -111,7 +111,7 @@ contract FlywheelCore is Auth {
return (accrueUser(strategy, user, state), accrueUser(strategy, secondUser, state));
}

/**
/**
@notice claim rewards for a given user
@param user the user claiming rewards
@dev this function is public, and all rewards transfer to the user
Expand All @@ -132,7 +132,7 @@ contract FlywheelCore is Auth {
ADMIN LOGIC
//////////////////////////////////////////////////////////////*/

/**
/**
@notice Emitted when a new strategy is added to flywheel by the admin
@param newStrategy the new added strategy
*/
Expand All @@ -155,7 +155,7 @@ contract FlywheelCore is Auth {
return allStrategies;
}

/**
/**
@notice Emitted when the rewards module changes
@param newFlywheelRewards the new rewards module
*/
Expand All @@ -173,7 +173,7 @@ contract FlywheelCore is Auth {
emit FlywheelRewardsUpdate(address(newFlywheelRewards));
}

/**
/**
@notice Emitted when the booster module changes
@param newBooster the new booster module
*/
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/Errors.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

/**
@title Shared Errors
Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/IFlywheelBooster.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";

Expand All @@ -8,9 +8,9 @@ import {ERC20} from "solmate/tokens/ERC20.sol";
@notice Flywheel is a general framework for managing token incentives.
It takes reward streams to various *strategies* such as staking LP tokens and divides them among *users* of those strategies.
The Booster module is an optional module for virtually boosting or otherwise transforming user balances.
The Booster module is an optional module for virtually boosting or otherwise transforming user balances.
If a booster is not configured, the strategies ERC-20 balanceOf/totalSupply will be used instead.
Boosting logic can be associated with referrals, vote-escrow, or other strategies.
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.
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IFlywheelRewards.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {FlywheelCore} from "../FlywheelCore.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/rewards/BaseFlywheelRewards.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {SafeTransferLib, ERC20} from "solmate/utils/SafeTransferLib.sol";
import {IFlywheelRewards} from "../interfaces/IFlywheelRewards.sol";
import {FlywheelCore} from "../FlywheelCore.sol";

/**
/**
@title Flywheel Reward Module
@notice Determines how many rewards accrue to each strategy globally over a given time period.
@dev approves the flywheel core for the reward token to allow balances to be managed by the module but claimed from core.
Expand Down
6 changes: 3 additions & 3 deletions src/rewards/FlywheelDynamicRewards.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import "./BaseFlywheelRewards.sol";
import {SafeCastLib} from "solmate/utils/SafeCastLib.sol";

/**
/**
@title Flywheel Dynamic Reward Stream
@notice Determines rewards based on a dynamic reward stream.
Rewards are transferred linearly over a "rewards cycle" to prevent gaming the reward distribution.
Rewards are transferred linearly over a "rewards cycle" to prevent gaming the reward distribution.
The reward source can be arbitrary logic, but most common is to "pass through" rewards from some other source.
The getNextCycleRewards() hook should also transfer the next cycle's rewards to this contract to ensure proper accounting.
*/
Expand Down
8 changes: 4 additions & 4 deletions src/rewards/FlywheelGaugeRewards.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {Auth, Authority} from "solmate/auth/Auth.sol";
import {SafeCastLib} from "solmate/utils/SafeCastLib.sol";
Expand All @@ -14,19 +14,19 @@ interface IRewardsStream {
function getRewards() external returns (uint256);
}

/**
/**
@title Flywheel Gauge Reward Stream
@notice Distributes rewards from a stream based on gauge weights
The contract assumes an arbitrary stream of rewards `S` of rewardToken. It chunks the rewards into cycles of length `l`.
The allocation function for each cycle A(g, S) proportions the stream to each gauge such that SUM(A(g, S)) over all gauges <= S.
The allocation function for each cycle A(g, S) proportions the stream to each gauge such that SUM(A(g, S)) over all gauges <= S.
NOTE it should be approximately S, but may be less due to truncation.
Rewards are accumulated every time a new rewards cycle begins, and all prior rewards are cached in the previous cycle.
When the Flywheel Core requests accrued rewards for a specific gauge:
1. All prior rewards before this cycle are distributed
2. Rewards for the current cycle are distributed proportionally to the remaining time in the cycle.
2. Rewards for the current cycle are distributed proportionally to the remaining time in the cycle.
If `e` is the cycle end, `t` is the min of e and current timestamp, and `p` is the prior updated time:
For `A` accrued rewards over the cycle, distribute `min(A * (t-p)/(e-p), A)`.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/rewards/FlywheelStaticRewards.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {Auth, Authority} from "solmate/auth/Auth.sol";
import "./BaseFlywheelRewards.sol";

/**
/**
@title Flywheel Static Reward Stream
@notice Determines rewards per strategy based on a fixed reward rate per second
*/
Expand Down
2 changes: 1 addition & 1 deletion src/test/FlywheelTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockBooster.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockRewards.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import "../../rewards/BaseFlywheelRewards.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/MockRewardsStream.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/rewards/FlywheelGaugeRewardsTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/rewards/FlywheelStaticRewardsTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/token/ERC20GaugesTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {MockERC20Gauges} from "../mocks/MockERC20Gauges.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/token/ERC20MultiVotes.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
pragma solidity ^0.8.10;

import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {MockERC20MultiVotes, ERC20MultiVotes} from "../mocks/MockERC20MultiVotes.sol";
Expand Down

0 comments on commit ba00148

Please sign in to comment.