Update to rewards calculations


Sundae Yield Farming v2 has launched successfully with rewards released daily.

However, a community member has noticed that someone has been providing liquidity just before the snapshot and removing it after and gaining full rewards while not carrying any of the risk that comes with liquidity providing and also not providing any benefit to sundaeswap. This someone is siphoning off sundae emission rewards that legit LPT should rightfully be entitled to for providing real liquidity & undertaking the IL risks while doing so.

We propose implementing a LP balance so that the LP Rewards are multiplied by what percentage of the day it is locked. For example if it is locked for 24hours then it will earn full rewards where 12 hours will only earn half rewards.

Vote no change to make no change to current reward calculation
Vote adjust calculation to adjust rewards based on how long they are in the liquidity pool (ie if someone is just locking up LP for 5-10 mins prior to snapshot, he shall be rewarded only prorated rewards)


In terms of making this concrete from an implementation perspective, here is how the calculation would change:

  1. Assume we’re calculating the rewards for date X, which is done at 2am UTC on date X+1, using the snapshot at midnight UTC between X and X+1;
  2. Identify the set of all positions that were created before and spent after the slot at midnight UTC between X-1 and X; these are our “initial positions”
  3. Identify all positions that were created before before and spent after the slot at midnight UTC between X and X+1; these are our “updated positions”
  4. for each initial position and updated position
    a. calculate the relevant_start_time as the maximum between the tx slot time, and the start of the day (midnight UTC between X-1 and X)
    b. calculate the relevant_end_time as the maximum between the tx spent slot time, and the end of the day (midnight UTC between X and X+1)
    c. sum up the LP tokens for each pool held by the position
    d. multiply the LP token quantity by (relevant_end_time - relevant_start_time) (in slots)
    e. divide this product by the number of slots in a day, 86400, rounded down.
    f. Add this to the LP weight by owner
  5. Split the received rewards among owners of the pool according to this prorated LP weight instead of the raw LP numbers

I think this proposal will at least “force” big players to take some risk if they wish to get nice daily rewards. In addition, the rewards HRA the community is seeing during the day might not change for some minutes around the snapshot midnight UTC as I noticed it dropping from 235% to 220% right before the snapshot and coming back up to 235% moments after the snapshot.