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

New MerkleDistribution contract that can trigger withdrawing TACoApp rewards #136

Closed
cygnusv opened this issue Feb 22, 2024 · 2 comments · Fixed by #149
Closed

New MerkleDistribution contract that can trigger withdrawing TACoApp rewards #136

cygnusv opened this issue Feb 22, 2024 · 2 comments · Fixed by #149
Assignees

Comments

@cygnusv
Copy link
Member

cygnusv commented Feb 22, 2024

Once we introduce rewards in the TACoApp contract, this will produce a fragmentation of the rewards between other apps (tBTC & RB, currently on the MerkleDistribution contract) and TACo. In order to eliminate this friction from a staker perspective, we should allow the MerkleDistribution contract to trigger withdrawing rewards to the beneficiary.

In addition to the changes mentioned in nucypher/nucypher-contracts#244 to the TACoApp, we'd need a new MerkleDistribution contract that performs this call. This issue includes also the migration of approvals from the ClaimableRewards proxy contract owned by Threshold.

@manumonti
Copy link
Member

The current approach is to have three claim functions that a stake can call:

  • claimMerkle(...) that will claim the rewards generated using Merkle distribution. I.e., the rewards that come from tBTC application.
  • claimApps(...) that will claim the rewards directly generated by the applications. At this moment, TACo.
  • claim(...) that will claim both types of rewards.

But this can be problematic:

The claim(...) function has as arguments those values related to a Merkle distribution: Merkle root, Merkle proof, and cumulative amount. But it may happen that a stake only runs a TACo application, so this stake won't have tBTC rewards. If no tBTC rewards are calculated, this stake won't be part of the Merkle distribution, so there won't be a Merkle proof to be passed as an argument to the claim function.

Two solutions are possible (if not more):

  • Adding this stake to the Merkle distribution with 0 tBTC rewards so a Merkle Proof will be generated.
  • Adding an if statement in the claim() function so if the Merkle Proof is null (or zero address), only the applications (TACo) rewards will be claimed.

cc @cygnusv

@manumonti
Copy link
Member

manumonti commented Jun 27, 2024

About claiming from the dashboard:

The idea is that the dashboard calls the claim() function in the RewardsAggregator contract. This function will:

  1. Send the Merkle rewards (i.e. tBTC rewards)
  2. Call the application's withdrawRewards() function (TACo at this moment). This function will send to the beneficiary the TACo rewards.

But what happens if the stake is not earning TACo rewards at all? This require will not be satisfied so the transaction will be reverted, and this leads to a bad user experience. Am I right?

Can we adapt the dashboard to ignore this? Probably not, because the revert message will be shown in the wallet (Metamask or whatever) and not in the dashboard, right?

cc @cygnusv

EDIT: solved by adding canClaimApps() function: f206374

@manumonti manumonti self-assigned this Jun 27, 2024
@manumonti manumonti linked a pull request Sep 5, 2024 that will close this issue
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