diff --git a/docs/run-first-validator.md b/docs/run-first-validator.md index 8e212f5..46ff836 100644 --- a/docs/run-first-validator.md +++ b/docs/run-first-validator.md @@ -4,6 +4,7 @@ - [ansible](playbooks/README.md#ansible-installation) - [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) +- Link to LPS distribution spreadsheet ## Export testnet state @@ -45,6 +46,14 @@ - Copy over the exported `testnet-state.json` file to target machine +- Generate LPS lockup distribution JSON file + + ``` + bash ~/cerc/laconicd-stack/scripts/generate-lps-lock.sh "" + ``` + + - This will generate the `distribution.json` file at `~/cerc/laconicd-stack/distribution.json` + - Copy over the LPS lockup distribution `distribution.json` file to target machine - Set envs: diff --git a/scripts/generate-lps-distribution-json.py b/scripts/generate-lps-distribution-json.py index 1bfe3fa..abdb82d 100644 --- a/scripts/generate-lps-distribution-json.py +++ b/scripts/generate-lps-distribution-json.py @@ -15,7 +15,6 @@ def get_excel_download_url(google_sheet_url): # Export the first sheet as Excel return f'https://docs.google.com/spreadsheets/d/{sheet_id}/export?format=xlsx&id={sheet_id}' - def download_excel(url, output_path): """ Download the Excel file from the given URL. @@ -26,7 +25,6 @@ def download_excel(url, output_path): with open(output_path, 'wb') as f: f.write(response.content) - def convert_excel_to_json(excel_path, json_path): """ Read the Excel file, extract columns from the 'Genesis Allocation' sheet, and save as JSON. @@ -63,7 +61,6 @@ def convert_excel_to_json(excel_path, json_path): with open(json_path, 'w') as f: json.dump(result, f, indent=2) - def main(): if len(sys.argv) != 2: print('Usage: python download_and_convert_google_sheet.py ') @@ -78,6 +75,5 @@ def main(): convert_excel_to_json(excel_path, json_path) print(f'JSON saved to {json_path}') - if __name__ == '__main__': main() diff --git a/scripts/generate-lps-lock.sh b/scripts/generate-lps-lock.sh new file mode 100644 index 0000000..a634a9b --- /dev/null +++ b/scripts/generate-lps-lock.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +sheet_url="$1" +venv_dir="$PWD/venv-lps-lock" +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Create venv if it doesn't exist +if [ ! -d "$venv_dir" ]; then + python3 -m venv "$venv_dir" +fi + +# Activate venv and install dependencies +"$venv_dir/bin/pip" install --upgrade pip > /dev/null +"$venv_dir/bin/pip" install requests pandas openpyxl > /dev/null + +echo "Running LPS lock generation script..." +"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" "$sheet_url" + +# Clean up venv +echo "Cleaning up..." +rm -rf "$venv_dir"