/bal-mining-scripts

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

BAL Mining

Set of scripts to calculate weekly BAL liquidity mining distributions.

On week 26, the process was ported over to Python with the blockchain-etl project on Google Bigquery as the source for state data, such as pools' balances, fees, liquidity providers etc. The legacy scripts used up to week 25 can be found in the js directory.

Historical Runs

Week Start Block End Block
1 10176690 10221761
2 10221761 10267003
3 10267003 10312236
4 10312236 10357402
5 10357402 10402520
6 10402520 10447836
7 10447836 10493044
8 10493044 10538187
9 10538187 10583488
10 10583488 10628811
11 10628811 10674230
12 10674230 10719753
13 10719753 10765333
14 10765333 10811169
15 10811169 10856779
16 10856779 10902386
17 10902386 10947679
18 10947679 10992408
19 10992408 11037419
20 11037419 11083026
21 11083026 11128711
22 11128711 11174328
23 11174328 11219938
24 11219938 11265559
25 11265559 11311151
26 11311151 11356700
27 11356700 11402291
28 11402291 11447731

Requirements

  • Python 3 + Jupyter Notebook
  • An ethereum node (for querying blocks timestamps and token decimals)
  • A service account key with read access to Google BigQuery

Setup

  • Install required packages: pip install -r requirements.txt
  • Configure environment variables:
    • ENDPOINT_URL: URL to an ethereum node that can be queried via Websockets
    • GOOGLE_APPLICATION_CREDENTIALS: path to a JSON file that contains a service account key with read access to Google BigQuery

Usage

  1. Start Jupyter Notebook: jupyter notebook
  2. Open the bal-mining.ipynb notebook
  3. Run all cells
  4. Plots are displayed throughout the notebook. JSON reports are stored in the reports directory, with a final tally of user address to BAL received stored in the report week folder at _totals.json

Weekly distributions

145,000 BAL will be distributed on a weekly basis. Liquidity providers must claim their BAL at claim.balancer.finance.

BAL Redirections

In case smart contracts which cannot receive BAL tokens are specified, owners of those smart contracts can choose to redirect BAL tokens to a new address. In order to submit a redirection request, submit a pull request to update redirect.json using "fromAddress" : "toAddress" along with some sort of ownership proof. Please reach out to the Balancer team if you need assistance.

BAL Redistributions

The mining script identifies the liquidity providers of configurable rights pools (CRPs) deployed via the CRPFactory and redistributes BAL earned by those pools appropriately. CRPs deployed via other methods should submit a pull request to update redistribute.json using "controllerAddress" : "poolDescription" along with some sort of ownership proof. Please reach out to the Balancer team if you need assistance.