Skip to content

Instantly share code, notes, and snippets.

View sambacha's full-sized avatar
:atom:

sam bacha sambacha

:atom:
View GitHub Profile

Trying Ezno checking today

This a short overview of some of the things you can do with Ezno today. If you find any problems, file an issue.

The following examples show some errors that have been caught using type checking, partial/const evaluation and effects.

To get started we will install oxidation-compiler which has bindings for Ezno's checker. (you can also get the binary from the releases page).

npm install -g oxidation-compiler@latest
@taarushv
taarushv / mev.js
Last active January 26, 2024 09:16
Analyzing backrun/rebate in txs 0/1/2 in https://etherscan.io/block/17358588
// TX 1 - Admin wallet enables trading on FCKIT token https://etherscan.io/tx/0x12b949cf5605bb4da83efd14b6d38ad628a9ebf3befb42141d2ddb8cfc43d53e
// TX 2 - Searcher uses a proxy contract to buy ~2B FCKIT --for 60 ETH-- into multiple wallets (and to pay builder for gas fees/rebate) https://etherscan.io/tx/0xc3a37580a96b52a718a5b516dfef209f150e87a75032c725536821ea0d6cc875
// TX 3 - Rebate is forwarded from the flashbots builder back to the user https://etherscan.io/tx/0x80dc2721d833cd221bdf9264f1138a88907f57303bc606f8ee4034297201e095
const { ethers } = require('ethers'); // v5
const rpc = "https://mainnet.infura.io/v3/YOUR_API_KEY_HERE"
const provider = new ethers.providers.JsonRpcProvider(rpc)
// uni v2 router, to fetch trades using logs
const uniPool ="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
@recmo
recmo / keccak-aarch64.rs
Last active October 17, 2023 23:17
Rust aarch64 FEAT_SHA3 implementation of keccak_f1600.
#![cfg(all(target_arch = "aarch64", target_feature = "sha3"))]
use core::arch::asm;
const RC: [u64; 24] = [
0x0000000000000001,
0x0000000000008082,
0x800000000000808a,
0x8000000080008000,
0x000000000000808b,
0x0000000080000001,
@engn33r
engn33r / vulncreate2detector.sh
Last active December 26, 2023 22:44
Detect contracts vulnerable to CREATE2 manipulation
#!/bin/bash
# This script is a hacked together PoC, don't trust it to work well
# For proper detection of vulnerable contracts, recursive testing must be performed because CREATE2 in a contract's ancestry could be problematic: https://medium.com/@jason.carver/defend-against-wild-magic-in-the-next-ethereum-upgrade-b008247839d2#3f90
# Improved tool and full research coming from yAcademy next month: https://twitter.com/yAcademyDAO
contract_addr="0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852" # default value is a uniswap V2 pair from https://v2.info.uniswap.org/pairs
etherscan_api_key=""
if [[ -z "$etherscan_api_key" ]]; then
@ttesmer
ttesmer / AD.hs
Last active June 7, 2024 03:56
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
# ▇ => ▇ + ▇
# Minimal runtime bytecode for a contract that mutates
# into two child contracts and then self-destructs
# 1st child contract receives the call value
# 2nd child contract recevies the remaining balance
# author: Saw-mon and Natalie
# constructor payload for the spawned contract
# ┏━━━━━━━━━━━━━━━━━━━ push1 RUNTIME_BYTECODE_LEN # L
@rossgalloway
rossgalloway / 0907-gov-attack-postmortem.md
Last active July 17, 2022 16:10
Summary of events of the governance attack on the YAM Treasury on July 9th, 2022
@VictorTaelin
VictorTaelin / inc_comparison.md
Created July 6, 2022 22:46
Inc contract comparison, Ethereum vs Kindelia

Ethereum

Deploy contract:

Code:

pragma solidity >=0.4.22 <=0.9.0;
@sambacha
sambacha / pkgIntegrity.cjs
Created July 3, 2022 22:57
package-integrity.js
//https://github.com/jupyter-widgets/ipywidgets/blob/master/scripts/package-integrity.js
var readFileSync = require('fs').readFileSync;
var writeFileSync = require('fs').writeFileSync;
var ts = require('typescript');
var glob = require('glob');
var childProcess = require('child_process');
var path = require('path');
// Packages to ignore
var IGNORE = {
@EllyLoel
EllyLoel / reset.css
Last active June 28, 2024 04:00
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/