-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
The issue
The dashboard calculates how many rewards are going to be received when a staker pushes the "Claim" button.
Currently, this calculation is made by checking the last updated Merkle Distribution file (rewards.json) and subtracting the number of rewards that have been claimed already.
To get the rewards already claimed, the dashboard checks the claimed
events emitted by the contract to the Ethereum network.
const claimedEvents = await getContractPastEvents(merkleDropContract, { |
But checking these past events is not a reliable way to check this, since:
- It is quite inefficient and it is getting more inefficient over time: as new blocks are generated in the blockchain, the earlier events are left behind.
- Some providers can restrict the oldest events: maybe the provider returns only the events that happened in the last x Ethereum blocks.
The fix
Instead of querying for events, the claimed rewards of a stake can be queried directly to CumulativeClaimed
in the Merkle distribution contract:
Metadata
Metadata
Assignees
Labels
No labels