Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am 0age on github.
  • I am 0age (https://keybase.io/0age) on keybase.
  • I have a public key whose fingerprint is EC35 AB0B 6C4A D409 0FEF 81D5 50F4 5C3C 02E6 FD2F

To claim this, I am signing this object:

@0age
0age / HomeWork.sol
Created June 9, 2019 14:33
HomeWork V1 source (flattened)
pragma solidity 0.5.9; // optimization enabled, runs: 10000, evm: constantinople
/**
* @title HomeWork Interface (version 1) - EIP165 ID 0xe5399799
* @author 0age
* @notice Homework is a utility to find, share, and reuse "home" addresses for
* contracts. Anyone can work to find a new home address by searching for keys,
* a 32-byte value with the first 20 bytes equal to the finder's calling address
* (or derived by hashing an arbitrary 32-byte salt and the caller's address),

Minimal Upgrade Beacon Proxy (runtime code)

  • Get the current implementation contract address from the upgrade beacon via STATICCALL
  • Then, put calldata in memory to supply as argument in DELEGATECALL to implementation
  • Finally, return or revert based on DELEGATECALL status, supplying return buffer in either case
  • 48 bytes long when using an upgrade beacon with a compact address (starts with 5 zero bytes)
0x59595959365960205959596e<upgrade_beacon_last_15_bytes>5afa1551368280375af43d3d93803e602e57fd5bf3

pc  op  name                      [stack] <memory> {return_buffer} *return* ~revert~
@0age
0age / wildcard-resolution-eip.md
Last active February 28, 2020 02:11
Initial draft of ENS wildcard resolution EIP

eip: title: ENS Wildcard Resolution author: Nick Johnson (@arachnid), 0age (@0age) discussions-to: https://github.com/ethereum/EIPs/issues/xxxx status: Draft type: Standards Track category: ERC status: Draft created: 2020-02-25

@0age
0age / simple-fraud-proof-l2-for-scalable-token-transfers.md
Last active March 30, 2020 18:48
Simple Fraud Proof L2 for Scalable Token Transfers

Simple Fraud Proof L2 for Scalable Token Transfers

Authors: @0age & @d1ll0n

This spec outlines an initial implementation of a simple Layer Two construction based on fraud proofs (i.e., Optimistic Rollup). It endeavors to remain as simple as possible while still affording important security guarantees and significant efficiency improvements. It is designed to support scalable token transfers in the near term, with an expectation that eventually more mature, generic L2 as production-ready platforms will become available.

Table of Contents

This file has been truncated, but you can view the full file.
{
"merkleRoot": "0x5742a126030bb1883ceea917fcf0c83ae453aefcd3a681c41481435c8a4beb88",
"tokenTotal": "0x042b42f28d278eee000000",
"claims": {
"0x00038783c2DD7325329d38a247C39515C6d4D696": {
"amount": "0x15af1d78b58c400000",
"index": 0,
"proof": [
"0xdfddeb287e097336de7b55dfac5a9374cbafadd19e6b34f5cc97caf85562c7e1",
"0xd302d40d8fa1cbf59290369c613ef2d7ee1750a7f50f019dbb3a298007e22370",
@0age
0age / summarizeUniProposal.js
Created October 27, 2020 15:05
Node.js web3 script for getting UNI proposal information.
const Web3 = require('web3');
const fs = require('fs');
process.chdir(__dirname);
const PROPOSAL_ID = 2;
const QUORUM = 40_000_000;
// Be sure to use a provider that can retrieve all required events.
const web3Provider = `https://eth-mainnet.alchemyapi.io/jsonrpc/${process.env.WEB3_API_KEY}`;
const web3 = new Web3(web3Provider);
@0age
0age / c000r.sol
Last active January 20, 2023 04:31
0xMonaco car (top-ranked finisher by ELO, Paradigm CTF 2022) https://0xmonaco.ctf.paradigm.xyz/viewTeam/OpenSea
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16; // (10M optimization runs)
interface MonacoInterface {
struct CarData {
uint32 balance; // Where 0 means the car has no money.
uint32 speed; // Where 0 means the car isn't moving.
uint32 y; // Where 0 means the car hasn't moved.
Car car;
}
@0age
0age / Seaport_Flattened.sol
Created May 16, 2023 16:38
Seaport version 1.5 (flattened)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
enum OrderType {
// 0: no partial fills, anyone can execute
FULL_OPEN,
// 1: partial fills supported, anyone can execute
PARTIAL_OPEN,
@0age
0age / Seaport_Flattened_Condensed.sol
Last active May 16, 2023 16:39
Seaport version 1.5 (flattened and whitespace-reduced)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
// Seaport version 1.5 (flattened and whitespace-reduced)
// compiled with viaIR: true, optimizer enabled with runs: 4_294_967_295, metadata bytecodeHash: none
// Deployed via cross-chain immutable create2 factory to 0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC
enum OrderType {/* 0: no partial fills, anyone can execute */ FULL_OPEN, /* 1: partial fills supported, anyone can execute */ PARTIAL_OPEN, /* 2: no partial fills, only offerer or zone can execute */ FULL_RESTRICTED, /* 3: partial fills supported, only offerer or zone can execute */ PARTIAL_RESTRICTED, /* 4: contract order type */ CONTRACT}
enum BasicOrderType {/* 0: no partial fills, anyone can execute */ ETH_TO_ERC721_FULL_OPEN, /* 1: partial fills supported, anyone can execute */ ETH_TO_ERC721_PARTIAL_OPEN, /* 2: no partial fills, only offerer or zone can execute */ ETH_TO_ERC721_FULL_RESTRICTED, /* 3: partial fills supported, only offerer or zone can execute */ ETH_TO_ERC721_PARTIAL_RESTRICTE