Skip to content

Instantly share code, notes, and snippets.

View karmacoma-eth's full-sized avatar

karmacoma karmacoma-eth

View GitHub Profile
@karmacoma-eth
karmacoma-eth / poc-enumerate.py
Last active October 16, 2023 22:09
enumerating possibles expression values with z3
from z3 import *
selector = BitVec('selector', 32)
expr = 107 + 4 * (selector % 16)
codesize = 128
s = Solver()
s.add(expr < codesize)
possible_jump_table_values = set([])
@karmacoma-eth
karmacoma-eth / linear-storage-poc.py
Created December 12, 2023 02:25
linear-storage-poc.py
from dataclasses import dataclass
from typing import Tuple
bytes32 = int
address = int
@dataclass
class Context:
context_address: address
@karmacoma-eth
karmacoma-eth / fup.sh
Last active February 26, 2024 11:42
foundryup script
# from https://twitter.com/0xYYY_/status/1562091599731228672
# put this before `source $ZSH/oh-my-zsh.sh`
FOUNDRY_PLUGIN_DIR=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/foundry
fpath+=$FOUNDRY_PLUGIN_DIR
fup () {
if ! command -v foundryup &> /dev/null
then
echo "Install foundryup first: https://getfoundry.sh"
@karmacoma-eth
karmacoma-eth / sending-ether-cheat-sheet.md
Last active March 12, 2024 01:14
Sending Ether Cheat Sheet

Sending Ether Cheat Sheet

TLDR

🥇 Instead of sending Ether, use the withdrawal pattern

🥈 If you really need to send Ether, use a safe wrapper like OpenZeppelin's Address.sendValue(addr, amount)

🥉 If you really need to send Ether without dependencies, use (bool success, ) = addr.call{value: amount}("")