Skip to content

Commit

Permalink
move vote prep check to be first
Browse files Browse the repository at this point in the history
  • Loading branch information
jalbrekt85 committed Dec 6, 2024
1 parent 6491bcd commit 8bf9f5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ APY needed,6%,,,
Incentives per 1m,60000,,,
Incentives per wk,"$1,154",,,
Incentives per 6 wks,"$4,615",,,
Total TVL to support,22,,,
Total TVL to support,22,,,
28 changes: 15 additions & 13 deletions tools/python/aura_snapshot_voting/review_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ def review_votes(week_string):
csv_file = csv_files[0]
vote_df = pd.read_csv(csv_file)

try:
test_df = vote_df.copy()
prop, _, _ = _get_prop_and_determine_date_range()
test_df, vote_choices = prepare_vote_data(test_df, prop)
data = create_vote_payload(vote_choices, prop)
hash = hash_eip712_message(data)
vote_prep = f"\n### Vote Preparation\nSuccessfully simulated vote preparation ✅\nMessage hash: `0x{hash.hex()}`"
vote_check = True
except Exception as e:
vote_prep = (
f"\n### Vote Preparation\n❌ Error simulating vote preparation: {str(e)}"
)
vote_check = False


vote_df = vote_df.dropna(subset=["Gauge Address", "Label", "Allocation %"])

gauge_labels = fetch_gauge_labels()
Expand All @@ -61,19 +76,6 @@ def review_votes(week_string):
total_allocation = vote_df["Allocation %"].str.rstrip("%").astype(float).sum()
allocation_check = abs(total_allocation - 100) < 0.0001

try:
prop, _, _ = _get_prop_and_determine_date_range()
vote_df, vote_choices = prepare_vote_data(vote_df, prop)
data = create_vote_payload(vote_choices, prop)
hash = hash_eip712_message(data)
vote_prep = f"\n### Vote Preparation\nSuccessfully simulated vote preparation ✅\nMessage hash: `0x{hash.hex()}`"
vote_check = True
except Exception as e:
vote_prep = (
f"\n### Vote Preparation\n❌ Error simulating vote preparation: {str(e)}"
)
vote_check = False

report = f"""## vLAURA Votes Review
CSV file: `{os.path.relpath(csv_file, project_root)}`
Expand Down
2 changes: 1 addition & 1 deletion tools/python/aura_snapshot_voting/vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def prepare_vote_data(vote_df, prop):
gauge_labels = {to_checksum_address(x["address"]): x["label"] for x in gauge_labels}
choice_index_map = {c: x + 1 for x, c in enumerate(choices)}

vote_df = vote_df.dropna(subset=["Gauge Address"])
vote_df = vote_df.dropna(subset=["Gauge Address", "Label", "Allocation %"])

vote_df["snapshot_label"] = vote_df["Gauge Address"].apply(
lambda x: gauge_labels.get(to_checksum_address(x.strip()))
Expand Down

0 comments on commit 8bf9f5d

Please sign in to comment.