Skip to content
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 15 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ runs:
run: forge compile --contracts proposals/
shell: bash

- name: Compile MultiRewarder
run: forge compile --contracts crv-rewards/
shell: bash
Copy link
Collaborator Author

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


- name: Compile Contracts
run: forge build
shell: bash
9 changes: 9 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this as well as the tests will be deleted once audit clears


86 changes: 86 additions & 0 deletions crv-rewards/IMultiRewards.sol
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;
}
Loading
Loading