Skip to content

Instantly share code, notes, and snippets.

@ethDreamer
ethDreamer / claim_params.py
Created February 23, 2024 02:39
StarkNet Airdrop Claim
#!/usr/bin/env python3
import sys
import json
import os
def find_account_inclusion_object(eligibles, eth_address):
for account in eligibles:
if account["identity"].lower() == eth_address.lower():
return account
return None
@ethDreamer
ethDreamer / gist:aff25ca271710363d0aedc4bf796b33d
Created December 21, 2023 14:48
PID Ticket Pricing Simulation
#!/usr/bin/env python3
import matplotlib.pyplot as plt
# The fair market value of a ticket above which people sell and below which people buy
def V_function(block_num):
if block_num < 8000:
return 0.05
elif block_num < 16000:
return 0.08
elif block_num < 20000:
@ethDreamer
ethDreamer / get_queue_position.py
Last active June 8, 2023 16:01
Calculate Activation Epoch
#!/usr/bin/env python3
import sys
import requests_cache
import json
BEACON_ENDPOINT = "http://localhost:5052"
FAR_FUTURE_EPOCH = 18446744073709551615
MAX_EFFECTIVE_BALANCE = 32000000000
MIN_PER_EPOCH_CHURN_LIMIT = 4
root@25c70e4d4c15:/home/beacon/run# PUBKEY1=0x810761e15a24fe47f6032658920063f74d7cc818d4138a25b1df7508fe0728295b52881b20325d99db4dbdcb59e9f7f3
root@25c70e4d4c15:/home/beacon/run# PUBKEY2=0xad2d9abf715412b5b4b7fad0e671d988dc170877bca0efe81fd438f6b52a41bb50b1c1ce8220ca0e7d892b4653a75a1e
root@25c70e4d4c15:/home/beacon/run# PUBKEY3=0x80395f593e4a71b789942ddad6f85eb05d458f060acf37fedde1257d59493fa484aa64451af9b352c3091cd6ffeb2528
root@25c70e4d4c15:/home/beacon/run# FEE_RECIPIENT2=0x0000000000000000000000000000000000000000
root@25c70e4d4c15:/home/beacon/run# FEE_RECIPIENT3=0x4242424242424242424242424242424242424242
root@25c70e4d4c15:/home/beacon/run# curl -X GET -H "Authorization: Bearer $(cat ${DATADIR}/validators/api-token.txt)" -H "Content-Type: application/json" http://localhost:5062/eth/v1/validator/${PUBKEY1}/feerecipient | jq
% Total % Received % Xferd Average Spee
@ethDreamer
ethDreamer / from_finalized_snapshot_refactor.rs
Created April 13, 2022 19:09
Refactor of from_finalized_snapshot()
pub fn from_finalized_snapshot(
finalized_branch: &[H256],
deposits: usize,
level: usize,
) -> Result<Self, MerkleTreeError> {
if let Some(hash) = finalized_branch.get(0) {
if deposits == (0x1 << level) {
return Ok(MerkleTree::Finalized(*hash));
}
if level == 0 {
pragma solidity ^0.4.0;
interface roller {
function roll2x() external payable;
function roll5x() external payable;
function roll10x() external payable;
}
#include <stdio.h>
int main(int argc, char **argv) {
return 0;
}