Skip to content

Commit

Permalink
Merge pull request #5 from BalancerMaxis/move_example_configs_out_of_way
Browse files Browse the repository at this point in the history
Remove "config" out of the fork wokflow
  • Loading branch information
Tritium-VLK authored May 31, 2024
2 parents 388e577 + 6e48390 commit e6a9c7f
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 189 deletions.
19 changes: 19 additions & 0 deletions automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# For a base/default test run:


### Copy constants.py.example to constants.py.
Make sure you copy/not rename so your config file isn't part of changes to the mother branch of your fork.

### Take a quick look at example_op_config.py, which is actvated based on FILE_PREFIX in constants.py
These 2 files are how you control stuff, assuming not too much has changed, the current config should be good enough to do something.

### Go back to the root of the repo and run
```bash
pip3 install -r requirements.txt
python main.py
```

### Check test results in the outputs folder
There's some example outputs there already.

To run for real, you want to follow a pattern similar to that described in `.github/workflows/main.yml`, passing in some arguments to main.
6 changes: 4 additions & 2 deletions automation/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from web3 import Web3

OUTPUT_FILE_PREFIX = "beets_lst_lrt"
# There should be a pool_config file named $FILE_PREFIX.py in the automation directory that holds the running pool config
# Outputs will also use this prefix
FILE_PREFIX = "example_op_config"

CHAIN_NAME = "optimism"
CURRENT_YEAR = 2024
# How many incentives should be taken away from vote following to be distributed as fixed incentives? Per 2 week epoch
Expand All @@ -12,7 +15,6 @@
TOKENS_TO_FOLLOW_VOTING = TOTAL_TOKENS_PER_EPOCH - FIXED_INCENTIVE_TOKENS_PER_EPOCH
DESIRED_DEFAULT_VOTE_CAP = 30


BALANCER_GAUGE_CONTROLLER_ABI = [
{
"stateMutability": "view",
Expand Down
File renamed without changes.
16 changes: 10 additions & 6 deletions automation/lstGrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from gql.transport.requests import RequestsHTTPTransport
from pycoingecko import CoinGeckoAPI
from web3 import Web3
import importlib

from automation.constants import TOTAL_TOKENS_PER_EPOCH
from automation.constants import TOKENS_TO_FOLLOW_VOTING
Expand All @@ -24,16 +25,19 @@
from automation.constants import MIN_BAL_IN_USD_FOR_BOOST
from automation.constants import POOLS_SNAPSHOTS_QUERY
from automation.constants import DESIRED_DEFAULT_VOTE_CAP
from automation.constants import OUTPUT_FILE_PREFIX
from automation.constants import FILE_PREFIX
from automation.emissions_per_year import (
get_emissions_per_week,
)
from automation.helpers import fetch_all_pools_info
from automation.helpers import get_abi
from automation.helpers import get_block_by_ts
from automation.pool_config import boost_data
from automation.pool_config import cap_override_data
from automation.pool_config import fixed_emissions_per_pool

# import boost_data, cap_override_data and fixed_emissions_per_pool from the python file specified in POOL_CONFIG
pool_config = importlib.import_module(f"automation.{FILE_PREFIX}")
boost_data = pool_config.boost_data
cap_override_data = pool_config.cap_override_data
fixed_emissions_per_pool = pool_config.fixed_emissions_per_pool
from bal_addresses import AddrBook
from bal_tools import Subgraph
from bal_addresses import to_checksum_address
Expand Down Expand Up @@ -224,7 +228,7 @@ def generate_and_save_transaction(

# Dump back to tokens_distribution_for_msig.json
with open(
f"{get_root_dir()}/output/{OUTPUT_FILE_PREFIX}_{start_date.date()}_{end_date.date()}.json",
f"{get_root_dir()}/output/{FILE_PREFIX}_{start_date.date()}_{end_date.date()}.json",
"w",
) as _f:
json.dump(output_data, _f, indent=4)
Expand Down Expand Up @@ -416,7 +420,7 @@ def run_stip_pipeline(end_date: int) -> None:
)
# Export to csv
gauge_distributions_df.to_csv(
f"{get_root_dir()}/output/{OUTPUT_FILE_PREFIX}_{start_date.date()}_{end_date.date()}.csv",
f"{get_root_dir()}/output/{FILE_PREFIX}_{start_date.date()}_{end_date.date()}.csv",
index=False,
)

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# TS_NOW = 1702512000
# TS_NOW = 1703721600 # 28-12-2023
TS_NOW = 1714600800 # 11-01-2024
TS_NOW = 1717106400 # 2024-05-31

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down
9 changes: 0 additions & 9 deletions output/beets_lst_lrt_2024-04-18_2024-05-02.csv

This file was deleted.

82 changes: 0 additions & 82 deletions output/beets_lst_lrt_2024-04-18_2024-05-02.json

This file was deleted.

7 changes: 0 additions & 7 deletions output/beets_lst_lrt_2024-05-16_2024-05-30.csv

This file was deleted.

82 changes: 0 additions & 82 deletions output/beets_lst_lrt_2024-05-16_2024-05-30.json

This file was deleted.

0 comments on commit e6a9c7f

Please sign in to comment.