-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
60 lines (44 loc) · 1.83 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import argparse
import os
from datetime import datetime
import pytz
from dotenv import load_dotenv
from fee_allocator.fee_allocator import FeeAllocator
from fee_allocator.utils import get_last_thursday_odd_week, fetch_collected_fees
parser = argparse.ArgumentParser()
parser.add_argument("--ts_now", help="Current timestamp", type=int, required=False)
parser.add_argument(
"--ts_in_the_past", help="Timestamp in the past", type=int, required=False
)
parser.add_argument(
"--output_file_name", help="Output file name", type=str, required=False
)
parser.add_argument("--fees_file_name", help="Fees file name", type=str, required=False)
ROOT = os.path.dirname(__file__)
now = datetime.utcnow()
DELTA = 6000
TS_NOW = int(now.timestamp()) - DELTA
TS_2_WEEKS_AGO = int(get_last_thursday_odd_week().timestamp())
def main() -> None:
load_dotenv()
args = parser.parse_args()
ts_now = args.ts_now or TS_NOW
ts_in_the_past = args.ts_in_the_past or TS_2_WEEKS_AGO
print(
f"\n\n\n------\nRunning from timestamps {ts_in_the_past} to {ts_now}\n------\n\n\n"
)
start_date = datetime.fromtimestamp(ts_in_the_past, tz=pytz.UTC).strftime("%Y-%m-%d")
end_date = datetime.fromtimestamp(ts_now, tz=pytz.UTC).strftime("%Y-%m-%d")
input_fees = fetch_collected_fees(start_date, end_date, args.fees_file_name)
date_range = (ts_in_the_past, ts_now)
fee_allocator = FeeAllocator(input_fees, date_range)
fee_allocator.run_config.set_core_pool_chains_data()
fee_allocator.run_config.set_aura_vebal_share()
fee_allocator.run_config.set_initial_pool_allocation()
fee_allocator.redistribute_fees()
fee_allocator.recon()
fee_allocator.generate_incentives_csv()
file_name = fee_allocator.generate_bribe_csv()
fee_allocator.generate_bribe_payload(file_name)
if __name__ == "__main__":
main()