diff --git a/automation/README.md b/automation/README.md new file mode 100644 index 0000000..ffd2209 --- /dev/null +++ b/automation/README.md @@ -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. \ No newline at end of file diff --git a/automation/constants.py b/automation/constants.py index 070f918..2a89468 100644 --- a/automation/constants.py +++ b/automation/constants.py @@ -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 @@ -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", diff --git a/automation/pool_config.py b/automation/example_op_config.py similarity index 100% rename from automation/pool_config.py rename to automation/example_op_config.py diff --git a/automation/lstGrant.py b/automation/lstGrant.py index 42f6642..c8ee7e8 100644 --- a/automation/lstGrant.py +++ b/automation/lstGrant.py @@ -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 @@ -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 @@ -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) @@ -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, ) diff --git a/main.py b/main.py index ee1fd13..fcd4731 100644 --- a/main.py +++ b/main.py @@ -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( diff --git a/output/beets_lst_lrt_2024-04-18_2024-05-02.csv b/output/beets_lst_lrt_2024-04-18_2024-05-02.csv deleted file mode 100644 index da99952..0000000 --- a/output/beets_lst_lrt_2024-04-18_2024-05-02.csv +++ /dev/null @@ -1,9 +0,0 @@ -recipientGaugeAddr,poolAddress,symbol,voteWeight,voteWeightNoBoost,distribution,pctDistribution,boost,staticBoost,dynamicBoost,cap,fixedIncentive -0xF27D53f21d024643d50de50183932F17638229F6,0x4Fd63966879300caFafBB35D157dC5229278Ed23,BPT-rETH-ETH,0.24556158423144378,0.8163780519450224,2256.0,30.0,0.300793956484245,1.0,0.300793956484245,30%,1500 -0x9F9f8d58496691D541C40dbc2b1b20f8C43e8d8C,0x7Ca75bdEa9dEde97F8B13C6641B768650CB83782,ECLP-wstETH-WETH,0.42267377515009097,0.3248988805581731,1976.874404983883,26.288223470530358,1.300939462838227,1.0,1.300939462838227,30%,0 -0x5669FB0DCfA758Bf69FB3AdAB14578EDe14cc89A,0x5F8893506Ddc4C271837187d14A9C87964a074Dc,bpt-ethtri,1.2707082353265393,0.8967209103405591,1504.0,20.0,1.4170610060201967,1.5,0.9170610060201968,20%,0 -0xC19055C2FF199Ba6190505Ef776573c8B7cC676A,0x004700ba0a4f5f22e1E78a277fCA55e36F47E09C,bpt-ankrgalaharm,0.35616767690822126,0.3184009029470098,1314.9207226297053,17.48564790730991,1.1186139034520792,1.75,0.36861390345207923,30%,0 -0x53bFf7a10181E4Fa2a92011dE9816220E0DaDd41,0xc1F46ce83439886F0ea9c21512b36e7E67239d2C,bpt-roabee,0.04229049777359418,0.071477753722798,201.76718915862585,2.683074323917897,0.5916595803724247,1.0,0.5916595803724247,30%,0 -0x758D3297d9D9325EFb6DD424a7B2EdCaB47e309E,0x2FEb76966459d7841fa8A7Ed0aa4bf574d6111Bf,bpt-yieldconcerto,0.04001608724192648,0.181943373112577,151.17426376617757,2.0102960607204463,0.2199370417144384,1.0,0.21993704171443845,30%,0 -0xc46AB6Aa92F7c30B8Fb1D445b4B957203EbBbd6e,0xA71021492a3966EeC735Ed1B505aFa097c7cFe6f,bpt-fraxethe,0.016966537003482458,0.10396764177861509,63.257706892491676,0.8411929108044105,0.1631905534571072,1.0,0.1631905534571072,30%,0 -0x80aDD8a1BF48AB726b96f19Ae1bF27A39e3C9cbD,0x2a5139cd86C041aa3467e649F5Ee0880A5de2f2F,bpt-stadue,0.014024386664857018,0.2339271940018846,52.00571256911555,0.6915653267169621,0.05995192959371809,1.0,0.0599519295937181,30%,0 diff --git a/output/beets_lst_lrt_2024-04-18_2024-05-02.json b/output/beets_lst_lrt_2024-04-18_2024-05-02.json deleted file mode 100644 index 4438936..0000000 --- a/output/beets_lst_lrt_2024-04-18_2024-05-02.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "version": "1.0", - "chainId": "42161", - "createdAt": 1691667397141, - "meta": { - "name": "Transactions Batch", - "description": "", - "txBuilderVersion": "1.16.1", - "createdFromSafeAddress": "0x2a185C8A3C63d7bFe63aD5d950244FFe9d0a4b60", - "createdFromOwnerAddress": "", - "checksum": "0x60b02488a85be3a01e98bf20b0a502aa807f462e6f59a740ec3d602a56a716ae" - }, - "transactions": [ - { - "to": "0x2CDE9919e81b20B4B33DD562a48a84b54C48F00C", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [], - "name": "redeemAllPlans", - "payable": false - }, - "contractInputsValues": null - }, - { - "to": "0x34a265e1EBCb31586293eb2D2f94c6ff2f920340", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [ - { - "name": "gaugeAddresses", - "type": "address[]", - "internalType": "address[]" - }, - { - "name": "amountsPerPeriod", - "type": "uint256[]", - "internalType": "uint256[]" - }, - { - "name": "maxPeriods", - "type": "uint8[]", - "internalType": "uint8[]" - } - ], - "name": "setRecipientList", - "payable": false - }, - "contractInputsValues": { - "gaugeAddresses": "[0xF27D53f21d024643d50de50183932F17638229F6,0x53bFf7a10181E4Fa2a92011dE9816220E0DaDd41,0x9F9f8d58496691D541C40dbc2b1b20f8C43e8d8C,0x758D3297d9D9325EFb6DD424a7B2EdCaB47e309E,0xc46AB6Aa92F7c30B8Fb1D445b4B957203EbBbd6e,0x5669FB0DCfA758Bf69FB3AdAB14578EDe14cc89A,0x80aDD8a1BF48AB726b96f19Ae1bF27A39e3C9cbD,0xC19055C2FF199Ba6190505Ef776573c8B7cC676A]", - "amountsPerPeriod": "[1128000000000000000000,100883594579312926953,988437202491941548032,75587131883088787276,31628853446245837943,752000000000000000000,26002856284557775978,657460361314852661962]", - "maxPeriods": "[2,2,2,2,2,2,2,2]" - } - }, - { - "to": "0x4200000000000000000000000000000000000042", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [ - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } - ], - "name": "transfer", - "payable": false - }, - "contractInputsValues": { - "to": "0x34a265e1EBCb31586293eb2D2f94c6ff2f920340", - "amount": "6020000000000000000000" - } - } - ] -} \ No newline at end of file diff --git a/output/beets_lst_lrt_2024-05-16_2024-05-30.csv b/output/beets_lst_lrt_2024-05-16_2024-05-30.csv deleted file mode 100644 index cd203bb..0000000 --- a/output/beets_lst_lrt_2024-05-16_2024-05-30.csv +++ /dev/null @@ -1,7 +0,0 @@ -recipientGaugeAddr,poolAddress,symbol,voteWeight,voteWeightNoBoost,distribution,pctDistribution,boost,staticBoost,dynamicBoost,cap,fixedIncentive -0x9F9f8d58496691D541C40dbc2b1b20f8C43e8d8C,0x7Ca75bdEa9dEde97F8B13C6641B768650CB83782,ECLP-wstETH-WETH,0.4849172551875385,0.534211977879445,15000.0,30.0,0.9077244151514874,1,0.9077244151514873,30%,0 -0x5669FB0DCfA758Bf69FB3AdAB14578EDe14cc89A,0x5F8893506Ddc4C271837187d14A9C87964a074Dc,bpt-ethtri,0.7334989857250758,0.9227297799735866,15000.0,30.0,0.7949228491856764,1,0.7949228491856764,30%,0 -0xF27D53f21d024643d50de50183932F17638229F6,0x4Fd63966879300caFafBB35D157dC5229278Ed23,BPT-rETH-ETH,0.2874139811332296,1.1593936378443337,10000.0,20.0,0.24790025729968623,1,0.24790025729968623,20%,3000 -0xC19055C2FF199Ba6190505Ef776573c8B7cC676A,0x004700ba0a4f5f22e1E78a277fCA55e36F47E09C,bpt-ankrgalaharm,0.16400220389152587,0.3219567731453448,8918.991565199118,17.837983130398236,0.5093919978427923,1,0.5093919978427923,30%,0 -0xc46AB6Aa92F7c30B8Fb1D445b4B957203EbBbd6e,0xA71021492a3966EeC735Ed1B505aFa097c7cFe6f,bpt-fraxethe,0.018919634310828798,0.1595698115743795,1075.204317197277,2.150408634394554,0.11856650154662796,1,0.11856650154662805,30%,0 -0xF6b4ace2D69a0c6f966D44448692cA392f29029A,0xE906d4C4fC4c3Fe96560De86B4bf7eD89aF9A69a,bpt-fraxsym,9.82146417920399e-05,0.1595698115743795,5.804117603602414,0.011608235207204828,0.0006154963825739657,1,0.0006154963825740108,30%,0 diff --git a/output/beets_lst_lrt_2024-05-16_2024-05-30.json b/output/beets_lst_lrt_2024-05-16_2024-05-30.json deleted file mode 100644 index 72dee59..0000000 --- a/output/beets_lst_lrt_2024-05-16_2024-05-30.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "version": "1.0", - "chainId": "42161", - "createdAt": 1691667397141, - "meta": { - "name": "Transactions Batch", - "description": "", - "txBuilderVersion": "1.16.1", - "createdFromSafeAddress": "0xb6BfF54589f269E248f99D5956f1fDD5b014D50e", - "createdFromOwnerAddress": "", - "checksum": "0x60b02488a85be3a01e98bf20b0a502aa807f462e6f59a740ec3d602a56a716ae" - }, - "transactions": [ - { - "to": "0x2CDE9919e81b20B4B33DD562a48a84b54C48F00C", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [], - "name": "redeemAllPlans", - "payable": false - }, - "contractInputsValues": null - }, - { - "to": "0xF23d8342881eDECcED51EA694AC21C2B68440929", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [ - { - "name": "gaugeAddresses", - "type": "address[]", - "internalType": "address[]" - }, - { - "name": "amountsPerPeriod", - "type": "uint256[]", - "internalType": "uint256[]" - }, - { - "name": "maxPeriods", - "type": "uint8[]", - "internalType": "uint8[]" - } - ], - "name": "setRecipientList", - "payable": false - }, - "contractInputsValues": { - "gaugeAddresses": "[0xF27D53f21d024643d50de50183932F17638229F6,0xF6b4ace2D69a0c6f966D44448692cA392f29029A,0x9F9f8d58496691D541C40dbc2b1b20f8C43e8d8C,0xc46AB6Aa92F7c30B8Fb1D445b4B957203EbBbd6e,0x5669FB0DCfA758Bf69FB3AdAB14578EDe14cc89A,0xC19055C2FF199Ba6190505Ef776573c8B7cC676A]", - "amountsPerPeriod": "[5000000000000000000000,2902058801801207010,7500000000000000000000,537602158598638538933,7500000000000000000000,4459495782599558879155]", - "maxPeriods": "[2,2,2,2,2,2]" - } - }, - { - "to": "0x912CE59144191C1204E64559FE8253a0e49E6548", - "value": "0", - "data": null, - "contractMethod": { - "inputs": [ - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } - ], - "name": "transfer", - "payable": false - }, - "contractInputsValues": { - "to": "0xF23d8342881eDECcED51EA694AC21C2B68440929", - "amount": "47000000000000000000000" - } - } - ] -} \ No newline at end of file