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

Read and withdraw available TACo rewards from app contract #756

Open
cygnusv opened this issue May 16, 2024 · 1 comment
Open

Read and withdraw available TACo rewards from app contract #756

cygnusv opened this issue May 16, 2024 · 1 comment

Comments

@cygnusv
Copy link
Member

cygnusv commented May 16, 2024

TACo will transition soon to purely on-chain rewards calculation. To that end, TACo rewards will be distributed directly from the app contract. Therefore, instead of reward amounts being read from a JSON file, they will be calculated directly by the app contract; similarly, instead of reward tokens being pulled from the ClaimableRewards proxy contract, TACo reward tokens will be pushed directly to the app contract by a bot.

How does this impact the dashboard? In the future, it is expected that rewards for all Threshold apps will operate automatically, but for the moment, we need to reconcile on-chain TACo rewards with off-chain TBTC rewards. A simple approach that hides this issue to the staker is to modify the MerkleDistribution contract to allow to trigger rewards withdrawals for TACo stakers. See threshold-network/merkle-distribution#136. We're already taking care of this.

Current flow is the following:

staker
 \__ Withdraw rewards in the dashboard
              \__ submit claim TX to Merkle contract
                              \__ Merkle contract pulls rewards from ClaimableRewards

Proposed flow is:

staker
 \__ Withdraw rewards in the dashboard
               \__ submit claim TX to new Merkle contract
                                   \__ Merkle contract pulls TBTC rewards from ClaimableRewards
                                   \__ Merkle contract triggers TACo rewards withdrawal

In both cases, the result is that the beneficiary account will receive both TBTC and TACo rewards, just that under the hood, rewards will come from different sources.

Similarly, for reading available rewards, the dashboard needs to be clever enough to understand that tBTC rewards are in the usual JSON file and that TACo rewards need to be fetch on-chain. For this, it just need to call TACoApplication.availableRewards(address _stakingProvider). See https://github.com/nucypher/nucypher-contracts/blob/449ec475c433043d53bff2b55eaab91d9d71c60e/contracts/contracts/TACoApplication.sol#L473. The dashboard will simply add both amounts and show a unified rewards amount, but in the future it can even show how much it corresponds to TACo and TBTC.

@cygnusv
Copy link
Member Author

cygnusv commented Jun 17, 2024

Continuing this topic, there's basically 2 actionable items on the dashboard regarding 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

No branches or pull requests

1 participant