velodrome-finance / sugar

Sugar makes Velodrome devs life sweeter 🍭
Other
47 stars 26 forks source link

Added retro votes and bribes. #4

Closed stas closed 2 years ago

stas commented 2 years ago

Pair sugar allows fetching retrospective votes and bribes off-chain right away.

A bit more context on how supply checkpoints are handled.

We assume it's the next week start timestamp, minus one second to get the end of the current week.

Next we need to find the checkpoint of the closest to the end of the week timestamp, and in the same time, look up for the start of the week timestamp to get the rewards!

The relevant change is: https://github.com/velodrome-finance/sugar/pull/4/files#diff-7bedc767f5ade6f7953eef00d33aa96d6d38313795cd8d14a68498058a62a184R293-R314

/cc @velodrome-finance/smart-contracts

ethzoomer commented 2 years ago

🐇