Skip to content

Commit

Permalink
Marking integration points for TACo app rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusv committed Sep 18, 2024
1 parent 8264be8 commit a6f087e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
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 @@ export const useFetchStakingRewards = () => {
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 @@ export const useFetchStakingRewards = () => {
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 @@ export const useClaimMerkleRewardsTransaction = (
])
}

// 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

0 comments on commit a6f087e

Please sign in to comment.