Skip to content

Instantly share code, notes, and snippets.

View jmcph4's full-sized avatar

Jack McPherson jmcph4

View GitHub Profile
digraph asset_graph {
node [shape = circle] "GBP" "USD" "JPY" ;
"GBP" -> "USD" [label = "1.25"];
"JPY" -> "GBP" [label = "0.01"];
"USD" -> "JPY" [label = "76.92307692307692"];
"USD" -> "GBP" [label = "0.8"];
"GBP" -> "JPY" [label = "100"];
"JPY" -> "USD" [label = "0.013"];
}
[package]
name = "uniswap_v2_prices"
edition = "2021"
[dependencies]
alloy = { git = "https://github.com/alloy-rs/alloy", features = [
"contract",
"network",
"providers",
"rpc",
sequenceDiagram
  actor Searcher
  actor Builder
  actor Relay
  actor Proposer
  
  Note over Searcher,Builder: Custom API
  Note over Builder,Relay: Relay API
 Note over Relay,Proposer: Builder API
@jmcph4
jmcph4 / merkle.rs
Last active February 14, 2024 04:52
use std::{convert::AsRef, env, fmt, fs::read_to_string};
use sha2::{Digest as ShaDigest, Sha256};
pub type Bytes = Vec<u8>;
#[derive(Clone, Debug)]
pub struct Plaintext(pub Bytes);
impl AsRef<[u8]> for Plaintext {
let top_val: serde_json::Value = serde_json::from_str(raw.as_ref())?;
let inner_val: &serde_json::Value = top_val
.get(
top_val
.as_object()
.unwrap()
.keys()
.collect::<Vec<_>>()
.first()
.unwrap(),

Direct Heimdall Usage

$ heimdall disassemble --rpc-url https://polygon.llamarpc.com 0x45068ef2273a928a9b092c5e41cdca1672ebc6921355deb3dcc5ae7b9a43db11
$ cat output/137/0x45068ef2273a928a9b092c5e41cdca1672ebc6921355deb3dcc5ae7b9a43db11/disassembled.asm
000000 GASLIMIT 
000001 MOD 
000002 DUP15 
000003 CALLCODE 
000004 unknown 
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;
contract Foo {
function bar() public pure {
assembly {
mstore(0x08, 0x01000000000000000000000000000000000000000000000000000000000000FF)
}
}
}
{
"peer_id": "16Uiu2HAkzG8D5PVPfZZBq3hvjKX2QyFfpVjCR2y5Te4Dff2xLckp",
"addresses": [
"/ip4/83.150.19.30/tcp/9001/p2p/16Uiu2HAkzG8D5PVPfZZBq3hvjKX2QyFfpVjCR2y5Te4Dff2xLckp"
],
"client_info": {
"kind": "Unknown",
"version": "unknown",
"os_version": "unknown",
"protocol_version": "unknown",
use std::io::{stdin, BufRead};
type Number = i64;
fn main() {
let mut nums: Vec<Number> = vec![];
loop {
if let Some(Ok(line)) = stdin().lock().lines().next() {
if let Ok(num) = line.parse::<Number>() {