Skip to content

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

Merged
raulk merged 148 commits intomainfrom
erc20-rewards
Nov 27, 2024
Merged

feat(misc): examples: validator rewards with ERC20 minting#1200
raulk merged 148 commits intomainfrom
erc20-rewards

Conversation

@cryptoAtwill
Copy link
Copy Markdown
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 <6364934+ec2@users.noreply.github.com>
Co-authored-by: Mikers <snissn@gmail.com>
Co-authored-by: raulk <raul@protocol.ai>
Co-authored-by: Shashank Trivedi <100513286+lordshashank@users.noreply.github.com>
Co-authored-by: Karel Moravec <moravec.wdd@gmail.com>
Co-authored-by: Karel Moravec <moravec.wdd@gmail.com>
Co-authored-by: raulk <raul@protocol.ai>
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants