Skip to content

Commit 06166dd

Browse files
committed
fix(examples): correct formula for bonding curve progress
1 parent 9495d25 commit 06166dd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

learning-examples/bonding-curve-progress/poll_bonding_curve_progress.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ def print_curve_status(state: dict) -> None:
9494
state: The parsed bonding curve state dictionary
9595
"""
9696
progress = 0
97-
if state["token_total_supply"]:
98-
progress = 100 - (100 * state["real_token_reserves"] / state["token_total_supply"])
97+
if state["complete"]:
98+
progress = 100.0
99+
else:
100+
# Pump.fun constants (already converted to human-readable format)
101+
TOTAL_SUPPLY = 1_000_000_000 # 1B tokens
102+
RESERVED_TOKENS = 206_900_000 # 206.9M tokens reserved for migration
103+
104+
initial_real_token_reserves = TOTAL_SUPPLY - RESERVED_TOKENS # 793.1M tokens
105+
106+
if initial_real_token_reserves > 0:
107+
left_tokens = state["real_token_reserves"]
108+
progress = 100 - (left_tokens * 100) / initial_real_token_reserves
99109

100110
print("=" * 30)
101111
print(f"Complete: {'✅' if state['complete'] else '❌'}")

0 commit comments

Comments
 (0)