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

feat(misc): examples: validator rewards with ERC20 minting #1200

Merged
merged 148 commits into from
Nov 27, 2024
Merged

Conversation

cryptoAtwill
Copy link
Contributor

Adding an example contract that mints erc20 token for validators to claim their rewards. Integration test is also included as an illustration purposes.

cryptoAtwill and others added 30 commits May 31, 2024 00:14
Co-authored-by: Eric Tu <[email protected]>
Co-authored-by: Mikers <[email protected]>
Co-authored-by: raulk <[email protected]>
Co-authored-by: Shashank Trivedi <[email protected]>
@cryptoAtwill cryptoAtwill requested a review from a team as a code owner November 14, 2024 13:16
subnetId = id;
}

function disburseRewards(SubnetID calldata id, ValidatorSummary calldata summary) external {
Copy link
Contributor

@karlem karlem Nov 15, 2024

Choose a reason for hiding this comment

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

Out of interest. How do we recommend to secure this? Surely not just everyone should be able to claim to rewards?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only the subnet actor can call this function, there is a check below.

@raulk raulk added the rewards label Nov 27, 2024
Base automatically changed from integration/rewards to main November 27, 2024 16:19
Copy link
Contributor

@raulk raulk left a comment

Choose a reason for hiding this comment

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

@cryptoAtwill LGTM! I adjusted this PR in minor ways:

  • Removed your custom implementation of Ownable; let's always use OpenZeppelin's instead of reinventing the wheel.
  • The minter can be the owner in this example; let's keep it simple.
  • We don't need the MintableERC20 interface; you can use an actual contract as a contract type. Removed that.

@raulk raulk changed the title feat(node): validator rewards with erc20 feat(node): validator rewards with ERC20 minting Nov 27, 2024
@raulk raulk changed the title feat(node): validator rewards with ERC20 minting feat(misc): examples: validator rewards with ERC20 minting Nov 27, 2024
@raulk raulk merged commit ed602ce into main Nov 27, 2024
13 checks passed
@raulk raulk deleted the erc20-rewards branch November 27, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants