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

Generalize rewards-related methods and events for IApplication #89

Closed
cygnusv opened this issue Apr 11, 2022 · 1 comment · Fixed by #95
Closed

Generalize rewards-related methods and events for IApplication #89

cygnusv opened this issue Apr 11, 2022 · 1 comment · Fixed by #95

Comments

@cygnusv
Copy link
Member

cygnusv commented Apr 11, 2022

In line with #88, I noticed there's no reference to rewards on IApplication, which implied that current prospective application contracts, namely PRE and tBTC, have their own implementation and interfaces. For the sake of interoperability with other dApps (e.g., dashboards), we should unify methods and events related to rewards and add them to IApplication.

To clarify, I'm not advocating for unifying the rewards distribution logic (although both PRE and tBTC follow the Unipool approach, a third application could follow a different rewards distribution mechanism), but for finding a generalized abstract interface that can be useful for all kinds of applications on Threshold. In very high-level terms, the functionalities of a Threshold application that are related to rewards are:

  1. The Threshold protocol grants/pushes rewards to an application
  2. The application has an internal mechanism to account for and distribute rewards to participating stakers
  3. Stakers can query the amount of rewards they've accrued so far
  4. Stakers can withdraw rewards from the application

I think all of these (except for functionality 2) should be generalized and added to IApplication.

@pdyraga
Copy link
Member

pdyraga commented Apr 11, 2022

Random Beacon application contract exposes function withdrawRewards(address stakingProvider) external. Identical function will soon be added to ECDSA (tBTC) application contract: keep-network/keep-core#2920. This should satisfy 4 assuming PRE uses something similar.

For 3, the call is trivial but we may have a problem proxying it through IApplication given the contract size constraints on RandomBeacon. We'll see what can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants