generated from Uniswap/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Reward Distributor #21
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
Merged
Merged
Conversation
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
zhongeric
reviewed
Mar 5, 2025
marktoda
reviewed
Mar 6, 2025
marktoda
reviewed
Mar 12, 2025
codyborn
reviewed
Mar 31, 2025
import {MessageHashUtils} from '@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol'; | ||
|
||
/// @title RewardDistributor | ||
/// @notice Distributes rewards to operators based on their attestations. Operators attest to a group of blocks (windows). Whenever a window is finalized, the reward is distributed to the operators that voted together with the majority of the votes. |
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.
nit: can add newlines to keep this under 80 chars in length
codyborn
reviewed
Mar 31, 2025
|
||
/// @notice Returns the block number of the scheduled window | ||
function blockNumber(NextWindow nextWindow) internal pure returns (uint256 blockNumber_) { | ||
return NextWindow.unwrap(nextWindow) >> 96; |
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.
nit: 96
can be a constant
codyborn
reviewed
Mar 31, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces a new
RewardDistributor
contract along with its associated parameters and interfaces, as well as updates to the testing framework to accommodate these changes. The most important changes include the implementation of theRewardDistributor
contract, the introduction of theRewardDistributorParams
contract, updates to theIFeeSplitter
interface, and the addition of new tests and mock contracts.New Contracts and Interfaces:
src/UVN/L2/RewardDistributor.sol
: Implements theRewardDistributor
contract, which manages the distribution of rewards based on attestations. It includes methods for attesting to blocks, scheduling new windows, and processing rewards.src/UVN/L2/RewardDistributorParams.sol
: Implements theRewardDistributorParams
contract, which manages parameters such as attestation window length and period. It includes methods for setting and getting these parameters.src/interfaces/UVN/L2/IRewardDistributor.sol
: Defines theIRewardDistributor
interface, including events and errors related to the reward distribution process.src/interfaces/UVN/L2/IRewardDistributorParams.sol
: Defines theIRewardDistributorParams
interface, including events and errors related to attestation parameters.Interface Updates:
src/interfaces/FeeSplitter/IFeeSplitter.sol
: Adds new methods to theIFeeSplitter
interface for retrieving addresses of various fee recipients.Testing Framework:
test/UVN/RewardDistributor.t.sol
: Adds new tests for theRewardDistributor
contract, including tests for attesting to blocks, handling attestation periods, and initializing windows correctly.test/mock/MockFeeSplitter.sol
: Introduces a mock implementation of theIFeeSplitter
interface for testing purposes.test/mock/MockVotesToken.sol
: Introduces a mock implementation of an ERC20 token with voting capabilities for testing purposes.