Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.41 KB

README.md

File metadata and controls

57 lines (38 loc) · 1.41 KB

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 TAP this is https://etherscan.io/token/0x54049236fc1db3e274128176efedf7c69b4c6335

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 = '0x54049236fc1db3e274128176efedf7c69b4c6335' and trans.to = '0x0000000000000000000000000000000000000000'
  1. Adjust removals of tokens to - amounts:
update trans
set quantity = quantity - (2*quantity)
where trans.to = '0x54049236fc1db3e274128176efedf7c69b4c6335'
  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.