Skip to content

Script to work out LP rewards for a given month (or time period).

Notifications You must be signed in to change notification settings

dovuofficial/lp-reward-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LP Reward Allocation

This is a simple script to work out pool allocation of rewards.

E.g. pay out a pro-rata allocation based on time and share of pool.

Steps:

  1. Obtain the Uni v2 token export. For DOV/ETH this is https://etherscan.io/token/0x610382C1968AA065A662E34E5a258CC64048324f

Note. You must extract from the beginning of time if you want to reward to users already in the pool.

  1. Import this in to a local mysql database (see tables.sql for structure). Ignore datatime field, you don't need it.

  2. Remove burns from the dataset with (replace 0x540 address with the token address in question as above):

Delete from
Trans
Where trans.from = '0x610382C1968AA065A662E34E5a258CC64048324f' and trans.to = '0x0000000000000000000000000000000000000000'
  1. Adjust removals of tokens to - amounts:
update trans
set quantity = quantity - (2*quantity)
where trans.to = '0x610382C1968AA065A662E34E5a258CC64048324f'
  1. Update recipient details:
update trans
set trans.from = trans.to where trans.from = '0x0000000000000000000000000000000000000000'
  1. Check and amend the reward and the date parameters in the script index.js

  2. Run the script (need to install dependencies with npm install first):

node index.js
  1. Extract the results:
select address, sum(amount)
from awards
group by address
order by address desc

TODO:

Steps 2 through 5 could easily be moved to the script.

About

Script to work out LP rewards for a given month (or time period).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages