Hey everyone,
I’m currently working on the distribution of vesting rewards. I’m pretty much done on the scraping scripts side of things, which you can check out here https://github.com/LufyCZ/sushi-retroactive-query. The code has not been reviewed yet by anyone, but the results seem about right.
As the best solution would be releasing the rewards on a block by block basis, I’d like to get as close as possible to that, in a gas efficient way of course. The current idea is using a merkle tree on chain, which should be fine. However, I need to figure out how to update the data as often as possible.
There could be a new contract deployed every week / month, but that would unfortunately increase the gas costs, especially for smaller farmers.
The other idea is, that we could update the data on one contract, again weekly/monthly. I feel like this would be the best solution. In my mind it works something like this:
-
- We freeze the claiming every Sunday (/ weekend)
-
- Go through the claim logs, subtract the amounts claimed
-
- Add the next weeks values
-
- Update the merkle tree root, clear the claimed map
-
- Unfreeze
This method is prone to human error though, and places more trust into the hands of the devs. Of course all the data would be verifiable, so it could be acceptable.
If you have any ideas, I’d love to hear them!