diff --git a/lockdrop-calculations.ipynb b/lockdrop-calculations.ipynb index 66928e3..003af76 100644 --- a/lockdrop-calculations.ipynb +++ b/lockdrop-calculations.ipynb @@ -12,12 +12,13 @@ "**Features:**\n", "- Adjust star and galaxy participation numbers by lock duration\n", "- Real-time calculation of allocations and bonus pools\n", + "- Preset scenarios available in dropdown (balanced, five-year focused, short-term focused, low participation)\n", "- Visualization of results" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "setup-imports", "metadata": {}, "outputs": [], @@ -27,7 +28,8 @@ " configure_matplotlib, print_constants_summary, calculate_dynamic_allocations,\n", " calculate_bonus_pools, calculate_final_allocations, generate_test_output,\n", " print_analysis_tables, create_visualization, PENALTY_RATES, NUM_STARS, NUM_GALAXIES,\n", - " create_experiment_widgets, create_calculate_function, create_scenario_loader, create_export_function\n", + " create_experiment_widgets, create_calculate_function, create_scenario_loader, create_export_function,\n", + " SCENARIOS\n", ")\n", "import json\n", "from decimal import Decimal\n", @@ -40,59 +42,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "show-constants", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "================================================================================\n", - "๐Ÿ“Š $Z LOCKDROP DISTRIBUTION - CORE CONSTANTS\n", - "================================================================================\n", - "\n", - "๐Ÿ”’ LOCKDROP ALLOCATION\n", - "+----------------------------------+-----------------+\n", - "| Parameter | Value |\n", - "+==================================+=================+\n", - "| Total Supply (1 $Z per Urbit ID) | 4,294,967,296 |\n", - "+----------------------------------+-----------------+\n", - "| Lockdrop Allocation % | 30.0% |\n", - "+----------------------------------+-----------------+\n", - "| Lockdrop Allocation ($Z) | 1,288,490,188.8 |\n", - "+----------------------------------+-----------------+\n", - "\n", - "โญ URBIT POINTS DISTRIBUTION\n", - "+--------------+---------------+----------------+\n", - "| Point Type | Count | Allocation % |\n", - "+==============+===============+================+\n", - "| Galaxies | 256 | 0.39% |\n", - "+--------------+---------------+----------------+\n", - "| Stars | 65,280 | 99.61% |\n", - "+--------------+---------------+----------------+\n", - "| Planets | 4,294,901,760 | 0% |\n", - "+--------------+---------------+----------------+\n", - "\n", - "โฑ๏ธ LOCKDROP PARAMETERS\n", - "+---------------------------------+---------------------+\n", - "| Parameter | Value |\n", - "+=================================+=====================+\n", - "| Block Duration | 2 seconds |\n", - "+---------------------------------+---------------------+\n", - "| Max Point Lock Duration (5 yrs) | 157,788,000 seconds |\n", - "+---------------------------------+---------------------+\n", - "| Total Blocks | 78,894,000 |\n", - "+---------------------------------+---------------------+\n", - "| Star Allocation % | 99.609375% |\n", - "+---------------------------------+---------------------+\n", - "| Galaxy Allocation % | 0.390625% |\n", - "+---------------------------------+---------------------+\n", - "\n", - "================================================================================\n" - ] - } - ], + "outputs": [], "source": [ "# Display core constants\n", "print_constants_summary()" @@ -105,95 +58,25 @@ "source": [ "## ๐ŸŽ›๏ธ Experimental Parameters\n", "\n", - "Adjust the participation numbers below to experiment with different scenarios. The default values represent a balanced distribution scenario." + "Adjust the participation numbers below to experiment with different scenarios. Use the preset dropdown to quickly load common scenarios, or manually adjust the values for custom experiments." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "input-parameters", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "==================================================\n", - "๐ŸŽฏ PARTICIPATION INPUT CONTROLS\n", - "==================================================\n", - "\n", - "โญ STAR PARTICIPATION\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "75120f519bd64aeb88163fdfb2f9aaed", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(IntText(value=8000, description='1 Year:', style=DescriptionStyle(description_width='80px')), Iโ€ฆ" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "๐ŸŒŒ GALAXY PARTICIPATION\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "83e348a914854ce0a4b3e75c58ecc94e", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(IntText(value=40, description='1 Year:', style=DescriptionStyle(description_width='80px')), Intโ€ฆ" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "d851d648f30247e2b98b4bd57a101562", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(button_style='success', description='๐Ÿ”„ Calculate Allocations', layout=Layout(margin='20px 0', width='20โ€ฆ" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "39b0b853b4bb4971b0ebbaa2fcd2e8e0", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create experiment widgets using refactored function\n", "widget_dict = create_experiment_widgets()\n", "\n", + "# Create calculation function using refactored approach\n", + "calculate_and_display = create_calculate_function(widget_dict)\n", + "\n", + "# Connect button to calculation function\n", + "widget_dict['calculate_button'].on_click(calculate_and_display)\n", + "\n", "# Display widgets\n", "print(\"๐ŸŽฏ PARTICIPATION INPUT CONTROLS\")\n", "print(\"=\"*50)\n", @@ -204,8 +87,13 @@ "print(\"\\n๐ŸŒŒ GALAXY PARTICIPATION\")\n", "display(widget_dict['galaxy_controls'])\n", "\n", - "# Calculate button\n", - "display(widget_dict['calculate_button'])\n", + "print(\"\\n๐ŸŽฎ PRESET SCENARIOS\")\n", + "display(widget_dict['scenario_dropdown'])\n", + "\n", + "# Action buttons\n", + "import ipywidgets as widgets\n", + "buttons_box = widgets.HBox([widget_dict['calculate_button'], widget_dict['export_button']])\n", + "display(buttons_box)\n", "\n", "# Output area\n", "display(widget_dict['output_area'])" @@ -213,140 +101,11 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "calculation-function", + "execution_count": null, + "id": "17264a50-2d4b-4c83-aa08-c3d2e1d90fdd", "metadata": {}, "outputs": [], - "source": [ - "# Create calculation function using refactored approach\n", - "calculate_and_display = create_calculate_function(widget_dict)\n", - "\n", - "# Connect button to calculation function\n", - "widget_dict['calculate_button'].on_click(calculate_and_display)" - ] - }, - { - "cell_type": "markdown", - "id": "preset-scenarios-header", - "metadata": {}, - "source": [ - "## ๐ŸŽฎ Preset Scenarios\n", - "\n", - "Try these interesting scenarios by running the code below:" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "preset-scenarios", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "๐Ÿ“‹ AVAILABLE PRESET SCENARIOS:\n", - "==================================================\n", - "\n", - "โ€ข balanced: Balanced distribution across all lock periods\n", - "\n", - "โ€ข five_year_focused: Most participants choose 5-year lock (maximum bonus scenario)\n", - "\n", - "โ€ข short_term_focused: Most participants choose shorter locks (high penalty scenario)\n", - "\n", - "โ€ข polarized: Split between 1-year and 5-year locks (maximum bonus per 5Y participant)\n", - "\n", - "โ€ข low_participation: Low overall participation scenario\n", - "\n", - "๐ŸŽฏ To load a scenario, call: load_scenario('scenario_name')\n", - "\n", - "Example: load_scenario('five_year_focused')\n" - ] - } - ], - "source": [ - "# Create scenario loader using refactored function\n", - "load_scenario = create_scenario_loader(widget_dict)\n", - "\n", - "# Display available scenarios\n", - "print(\"๐Ÿ“‹ AVAILABLE PRESET SCENARIOS:\")\n", - "print(\"=\"*50)\n", - "\n", - "scenarios = {\n", - " 'balanced': 'Balanced distribution across all lock periods',\n", - " 'five_year_focused': 'Most participants choose 5-year lock (maximum bonus scenario)',\n", - " 'short_term_focused': 'Most participants choose shorter locks (high penalty scenario)',\n", - " 'polarized': 'Split between 1-year and 5-year locks (maximum bonus per 5Y participant)',\n", - " 'low_participation': 'Low overall participation scenario'\n", - "}\n", - "\n", - "for name, description in scenarios.items():\n", - " print(f\"\\nโ€ข {name}: {description}\")\n", - "\n", - "print(\"\\n๐ŸŽฏ To load a scenario, call: load_scenario('scenario_name')\")\n", - "print(\"\\nExample: load_scenario('five_year_focused')\")" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "load-scenario-example", - "metadata": {}, - "outputs": [], - "source": [ - "# Load the balanced scenario as default\n", - "# load_scenario('short_term_focused')" - ] - }, - { - "cell_type": "markdown", - "id": "export-section", - "metadata": {}, - "source": [ - "## ๐Ÿ’พ Export Results\n", - "\n", - "Export your experimental results." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "export-results", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "๐Ÿ’พ Export your current scenario results:\n", - " export_current_scenario('my_experiment.json')\n", - "\n", - "๐Ÿ“‹ Or use default filename:\n", - " export_current_scenario()\n" - ] - } - ], - "source": [ - "# Create export function using refactored approach\n", - "export_current_scenario = create_export_function(widget_dict)\n", - "\n", - "# Usage example\n", - "print(\"๐Ÿ’พ Export your current scenario results:\")\n", - "print(\" export_current_scenario('my_experiment.json')\")\n", - "print(\"\\n๐Ÿ“‹ Or use default filename:\")\n", - "print(\" export_current_scenario()\")" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "3c93c9c2-9cec-4d2b-a2db-065602a3871c", - "metadata": {}, - "outputs": [], - "source": [ - "# Export allocation results from the experiment\n", - "# export_current_scenario(\"lockdrop_allocations_experiment.json\")" - ] + "source": [] } ], "metadata": {