From 0be9dd8f90d025eb3b508828b7140f5b51ee7659 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Tue, 3 Jun 2025 12:38:12 +0530 Subject: [PATCH] Skip invalid entries --- scripts/generate-lps-distribution-json.py | 8 ++++++++ scripts/generate-lps-lock.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/generate-lps-distribution-json.py b/scripts/generate-lps-distribution-json.py index 792afeb..ba78dcd 100644 --- a/scripts/generate-lps-distribution-json.py +++ b/scripts/generate-lps-distribution-json.py @@ -4,6 +4,7 @@ import pandas as pd import json import re import argparse +from bech32 import bech32_decode def get_excel_download_url(google_sheet_url): """ @@ -57,6 +58,13 @@ def convert_excel_to_json(excel_path, json_path, sheet_name): if not key or key.lower() == 'nan': continue + # If key is the laconic address, validate that it's a valid bech32 address + if key == laconic_address: + hrp, data = bech32_decode(laconic_address) + if hrp is None or data is None or not hrp.startswith("laconic"): + print(f"Skipping invalid Laconic address: {laconic_address}") + continue + entry = { 'total_lps_allocation': row['Total LPS Allocation'] if not pd.isna(row['Total LPS Allocation']) else None, 'lock_months': row['Lock (months)'] if not pd.isna(row['Lock (months)']) else None, diff --git a/scripts/generate-lps-lock.sh b/scripts/generate-lps-lock.sh index 72c6936..fc3c7a3 100755 --- a/scripts/generate-lps-lock.sh +++ b/scripts/generate-lps-lock.sh @@ -50,7 +50,7 @@ fi # Activate venv and install dependencies "$venv_dir/bin/pip" install --upgrade pip -"$venv_dir/bin/pip" install requests pandas openpyxl +"$venv_dir/bin/pip" install requests pandas openpyxl bech32 echo "Running LPS lock generation script..." "$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \