Uniswap / v3-staker

Canonical liquidity mining contract for Uniswap V3
https://uniswap.org
GNU General Public License v3.0
353 stars 199 forks source link

No path to match all rewards claimed+unclaimed to a specific position #213

Closed mariorz closed 2 years ago

mariorz commented 2 years ago

Because the RewardClaimed events only include "to" and "reward" (qty) attributes, there is no way to match them with the position the accrued the fees being claimed. This issue seems to be pretty deep within the contract design as the rewards mapping only uses reward token addresses and owner address, so potentially a call to claimRewards is claiming rewards for multiple rewards programs or multiple positions.

getRewardInfo is of course handy to get unclaimed rewards for a position, but not for rewards that have already been claimed.

Given the above, there seems to be no path to accurately account for all the rewards accrued by a specific position with blockchain data.

Was there some thought put into how to match total rewards (claimed+unclaimed) to their corresponding NFT ids? Perhaps there is some path I'm not considering. Thanks.

mariorz commented 2 years ago

Closing this since realized a possible path is to filter logs for TokenUnstaked events for a specific NFT id, and then get the RewardClaim events emitted in the same transaction.