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

[Draft] Integrate TACo app rewards #780

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/hooks/useFetchStakingRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
return
}

// TODO:
// - Integration of new Merkle contract + TACo automated rewards here.
// TLDR: stakingRewards = merkle_rewards + taco_rewards
// See https://github.com/threshold-network/token-dashboard/issues/756
// - There's a more efficient way to check Merkle's claimed rewards.
// See https://github.com/threshold-network/token-dashboard/issues/765
// - Note also that TACo rewards now accrue on each block. They can be
// calculated via TACoApp.availableRewards(address _stakingProvider)
const claimedEvents = await getContractPastEvents(merkleDropContract, {
eventName: "Claimed",
fromBlock: DEPLOYMENT_BLOCK,
Expand Down Expand Up @@ -71,10 +79,14 @@
claimedRewardsInCurrentMerkleRoot.has(stakingProvider)
) {
// If the JSON file doesn't contain proofs for a given staking
// provider it means this staking provider has no rewards- we can skip
// this iteration. If the `Claimed` event exists with a current merkle
// provider it means this staking provider has no Merkle rewards -

Check failure on line 82 in src/hooks/useFetchStakingRewards.ts

View workflow job for this annotation

GitHub Actions / Check code format

Delete `·`
// we can skip this iteration.
// TODO: ^ But there's going to be TACo rewards

// If the `Claimed` event exists with a current merkle
// root for a given staking provider it means that rewards have
// already been claimed- we can skip this iteration.
// already been claimed - we can skip this iteration.
// TODO: ^ Same, there can be TACo rewards
continue
}

Expand Down
5 changes: 5 additions & 0 deletions src/web3/hooks/useClaimMerkleRewardsTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
])
}

// TODO:
// - This only signals no Merkle rewards, but there may be TACo rewards
// - We can still call the new Merkle contract with a claim with an empty

Check failure on line 39 in src/web3/hooks/useClaimMerkleRewardsTransaction.ts

View workflow job for this annotation

GitHub Actions / Check code format

Delete `·`
// merkle proof, signalling to not try to claim Merkle rewards. This
// will still try to claim TACo rewards automatically.
if (availableRewardsToClaim.length === 0) {
throw new Error("No rewards to claim.")
}
Expand Down
2 changes: 2 additions & 0 deletions src/web3/hooks/useMerkleDropContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AddressZero } from "../utils"

export const DEPLOYMENT_BLOCK = supportedChainId === "1" ? 15146501 : 0

// TODO:
// - Update new MerkleRewards contract address here
const CONTRACT_ADDRESSESS = {
// https://etherscan.io/address/0xea7ca290c7811d1cc2e79f8d706bd05d8280bd37
[ChainID.Ethereum.valueOf().toString()]:
Expand Down
Loading