"""Token Launch scenario tab.""" import streamlit as st from src.composed.simulator import scenario_token_launch from dashboard.charts import fig_simulation_overview def render(): st.header("Token Launch Simulation") config = st.session_state.get("myco_config") n_assets = config.n_reserve_assets if config else 3 col1, col2, col3 = st.columns(3) with col1: n_depositors = st.slider("Depositors", 10, 200, 50) with col2: total_raise = st.number_input("Total raise ($)", 10_000, 1_000_000, 100_000, step=10_000) with col3: duration = st.slider("Duration (days)", 30, 365, 90) st.caption(f"Using **{n_assets}** reserve assets from System Config.") if st.button("Run Simulation", key="token_launch_run"): with st.spinner("Running token launch simulation..."): result = scenario_token_launch( n_assets=n_assets, total_raise=float(total_raise), n_depositors=n_depositors, duration=float(duration), ) st.session_state["token_launch_result"] = result if "token_launch_result" in st.session_state: result = st.session_state["token_launch_result"] # Metric cards m1, m2, m3, m4 = st.columns(4) m1.metric("Final Supply", f"{result.supply[-1]:,.0f}") m2.metric("Final Reserve", f"${result.reserve_value[-1]:,.0f}") m3.metric("Backing Ratio", f"{result.backing_ratio[-1]:.4f}") m4.metric("Total Minted", f"{result.financial_minted[-1] + result.commitment_minted[-1]:,.0f}") st.plotly_chart(fig_simulation_overview(result), use_container_width=True)