-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRV MultiRewarder Contract #485
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b3d6981
init crv multirewarder contract
ElliotFriedman 67915da
add Compile MultiRewarder task
ElliotFriedman 878a57d
naming: crv-rewards/MultiRewarder.sol -> crv-rewards/MultiRewards.sol
ElliotFriedman 864ca25
add DeployMultiRewards script
ElliotFriedman 8313490
add MultiRewards test for adding reward streams
ElliotFriedman 565da60
add multi-user multi reward token test
ElliotFriedman 9cb69b9
add Run MultiRewards Tests job
ElliotFriedman 57ccf34
add post deploy assertions
ElliotFriedman 14ef3a0
add MultiRewards interface
ElliotFriedman b12000e
remove _ from helper functions, add assertion that tokens are transfe…
ElliotFriedman b611ad5
refactor: use MultiRewardsDeploy
ElliotFriedman f295bf1
Merge branch 'main' into feat/curve-multi-rewarder
ElliotFriedman 4275114
remove withdraw reward token check in recoverERC20, add comment expla…
ElliotFriedman 0a9781e
add testRecoverRewardToken
ElliotFriedman 99700a5
Merge branch 'feat/curve-multi-rewarder' of github.com:moonwell-fi/mo…
ElliotFriedman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,12 @@ jobs: | |
max_attempts: 3 | ||
command: time forge test -vvv --match-contract UnitTest | ||
|
||
- name: Run MultiRewards Tests | ||
uses: nick-fields/retry@v3 | ||
with: | ||
polling_interval_seconds: 30 | ||
retry_wait_seconds: 60 | ||
timeout_minutes: 20 | ||
max_attempts: 3 | ||
command: time forge test --match-path test/unit/MultiRewards.t.sol -vvv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this as well as the tests will be deleted once audit clears |
||
|
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,86 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.19; | ||
|
||
interface IMultiRewards { | ||
struct Reward { | ||
address rewardsDistributor; | ||
uint256 rewardsDuration; | ||
uint256 periodFinish; | ||
uint256 rewardRate; | ||
uint256 lastUpdateTime; | ||
uint256 rewardPerTokenStored; | ||
} | ||
|
||
// Events | ||
event RewardAdded(uint256 reward); | ||
event Staked(address indexed user, uint256 amount); | ||
event Withdrawn(address indexed user, uint256 amount); | ||
event RewardPaid( | ||
address indexed user, | ||
address indexed rewardsToken, | ||
uint256 reward | ||
); | ||
event RewardsDurationUpdated(address token, uint256 newDuration); | ||
event Recovered(address token, uint256 amount); | ||
event OwnerNominated(address newOwner); | ||
event OwnerChanged(address oldOwner, address newOwner); | ||
event PauseChanged(bool isPaused); | ||
|
||
// View functions | ||
function owner() external view returns (address); | ||
function nominatedOwner() external view returns (address); | ||
function stakingToken() external view returns (address); | ||
function rewardData( | ||
address | ||
) | ||
external | ||
view | ||
returns ( | ||
address rewardsDistributor, | ||
uint256 rewardsDuration, | ||
uint256 periodFinish, | ||
uint256 rewardRate, | ||
uint256 lastUpdateTime, | ||
uint256 rewardPerTokenStored | ||
); | ||
function rewardTokens(uint256) external view returns (address); | ||
function totalSupply() external view returns (uint256); | ||
function balanceOf(address account) external view returns (uint256); | ||
function lastTimeRewardApplicable( | ||
address _rewardsToken | ||
) external view returns (uint256); | ||
function rewardPerToken( | ||
address _rewardsToken | ||
) external view returns (uint256); | ||
function earned( | ||
address account, | ||
address _rewardsToken | ||
) external view returns (uint256); | ||
function getRewardForDuration( | ||
address _rewardsToken | ||
) external view returns (uint256); | ||
|
||
// Mutative functions | ||
function nominateNewOwner(address _owner) external; | ||
function acceptOwnership() external; | ||
function setPaused(bool _paused) external; | ||
function addReward( | ||
address _rewardsToken, | ||
address _rewardsDistributor, | ||
uint256 _rewardsDuration | ||
) external; | ||
function setRewardsDistributor( | ||
address _rewardsToken, | ||
address _rewardsDistributor | ||
) external; | ||
function stake(uint256 amount) external; | ||
function withdraw(uint256 amount) external; | ||
function getReward() external; | ||
function exit() external; | ||
function notifyRewardAmount(address _rewardsToken, uint256 reward) external; | ||
function recoverERC20(address tokenAddress, uint256 tokenAmount) external; | ||
function setRewardsDuration( | ||
address _rewardsToken, | ||
uint256 _rewardsDuration | ||
) external; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be deleted once we pass audit