Created
March 8, 2025 00:15
-
-
Save bartenbach/56729d70d264f8d351d1e94e266c9749 to your computer and use it in GitHub Desktop.
Simulation based on how I think people will vote on SIMD-0228 (Disclaimer: This is a simulation and a guess. Add your own vote accounts and guesses)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Mapping of vote account addresses to their intended vote | |
vote_mapping = { | |
"PineDoC593nrX16W8ZLWfF5Evb6otv7fRfZMLjPAHe3": "no", | |
"5iZ5PQPy5Z9XDnkfoWPi6nvUgtxWnRFwZ36WaftPuaVM": "no", | |
"he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk": "yes", | |
"FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk": "no", | |
"BLADE1qNA1uNjRgER6DtUFf7FU3c1TWLLdpPeEcKatZ2": "no", | |
"9GJmEHGom9eWo4np4L5vC6b6ri1Df2xN8KFoWixvD1Bs": "yes", | |
"Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6": "yes", | |
"HxRrsnbc6K8CdEo3LCTrSUkFaDDxv9BdJsTDzBKnUVWH": "yes", | |
"EARNynHRWg6GfyJCmrrizcZxARB3HVzcaasvNa8kBS72": "yes", | |
"GE6atKoWiQ2pt3zL7N13pjNHjdLVys8LinG8qeJLcAiL": "yes", | |
"AS3nKBQfKs8fJ8ncyHrdvo4FDT6S8HMRhD75JjCcyr1t": "no", | |
"DsiG71AvUHUEo9rMMHqM9NAWQ6ptguRAHyot6wGzLJjx": "no", | |
"oRAnGeU5h8h2UkvbfnE5cjXnnAa4rBoaxmS4kbFymSe": "yes", | |
"Pond1QyT1sQtiru3fi9G5LGaLRGeUpJKR1a2gdbq2u4": "no", | |
"voteRnv6PBzmiGP8NicWtQiqEJTwKKq2SxtqtdLUJjd": "no", | |
"juicQdAnksqZ5Yb8NQwCLjLWhykvXGktxnQCDvMe6Nx": "no", | |
"BeachiopjxQxL7CaHNSZsynApiZCKx9QFVtcWNz3jDBo": "no", | |
"punK4RDD3pFbcum79ACHatYPLLE1hr5UNnQVUGNfeyP": "yes", | |
"7emL18Bnve7wbYE9Az7vYJjikxN6YPU81igf6rVU5FN8": "yes", | |
"SBLZib4npE7svxFA7AsD3ytdQAfYNb39c8zsU82AA2E": "no", | |
"C616NHpqpaiYpqVAv619QL73vEqKJs1mjsJLtAuCzMX6": "no", | |
} | |
def fetch_vote_accounts(): | |
""" | |
Fetch vote account data from the Solana mainnet JSON RPC endpoint. | |
""" | |
url = "https://api.mainnet-beta.solana.com" | |
headers = {"Content-Type": "application/json"} | |
payload = { | |
"jsonrpc": "2.0", | |
"id": 1, | |
"method": "getVoteAccounts", | |
"params": [{"commitment": "finalized"}] | |
} | |
response = requests.post(url, headers=headers, json=payload) | |
response.raise_for_status() # Raise an error if the request fails | |
return response.json() | |
def get_stake_for_account(vote_account, current_accounts, delinquent_accounts): | |
""" | |
Search for the vote account in both the current and delinquent lists. | |
Returns the activated stake (in lamports) if found, or 0 otherwise. | |
""" | |
for account in current_accounts: | |
if account["votePubkey"] == vote_account: | |
return account["activatedStake"] | |
for account in delinquent_accounts: | |
if account["votePubkey"] == vote_account: | |
return account["activatedStake"] | |
return 0 | |
def main(): | |
# Fetch vote account data from the Solana network | |
data = fetch_vote_accounts() | |
current_accounts = data["result"]["current"] | |
delinquent_accounts = data["result"]["delinquent"] | |
yes_stake = 0 | |
no_stake = 0 | |
# Process each vote account based on the provided mapping | |
for vote_account, vote in vote_mapping.items(): | |
stake = get_stake_for_account(vote_account, current_accounts, delinquent_accounts) | |
if vote.lower() == "yes": | |
yes_stake += stake | |
elif vote.lower() == "no": | |
no_stake += stake | |
else: | |
print(f"Unrecognized vote option for account {vote_account}: {vote}") | |
total_stake = yes_stake + no_stake | |
if total_stake > 0: | |
percent_yes = (yes_stake / total_stake) * 100 | |
percent_no = (no_stake / total_stake) * 100 | |
print(f"Total stake voting YES: {yes_stake} lamports ({percent_yes:.2f}%)") | |
print(f"Total stake voting NO: {no_stake} lamports ({percent_no:.2f}%)") | |
else: | |
print("No stake found for the provided vote accounts.") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment