Skip to content

Instantly share code, notes, and snippets.

0age / c000r.sol
Last active Jan 20, 2023
0xMonaco car (top-ranked finisher by ELO, Paradigm CTF 2022)
View c000r.sol
// 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 / summarizeUniProposal.js
Created Oct 27, 2020
Node.js web3 script for getting UNI proposal information.
View summarizeUniProposal.js
const Web3 = require('web3');
const fs = require('fs');
const PROPOSAL_ID = 2;
const QUORUM = 40_000_000;
// Be sure to use a provider that can retrieve all required events.
const web3Provider = `${process.env.WEB3_API_KEY}`;
const web3 = new Web3(web3Provider);
View phase-one-merkle-root.json
This file has been truncated, but you can view the full file.
"merkleRoot": "0x5742a126030bb1883ceea917fcf0c83ae453aefcd3a681c41481435c8a4beb88",
"tokenTotal": "0x042b42f28d278eee000000",
"claims": {
"0x00038783c2DD7325329d38a247C39515C6d4D696": {
"amount": "0x15af1d78b58c400000",
"index": 0,
"proof": [
0age /
Last active Mar 30, 2020
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

0age /
Last active Feb 28, 2020
Initial draft of ENS wildcard resolution EIP

eip: title: ENS Wildcard Resolution author: Nick Johnson (@arachnid), 0age (@0age) discussions-to: status: Draft type: Standards Track category: ERC status: Draft created: 2020-02-25


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)

pc  op  name                      [stack] <memory> {return_buffer} *return* ~revert~
0age / HomeWork.sol
Created Jun 9, 2019
HomeWork V1 source (flattened)
View HomeWork.sol
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),
0age / MetamorphicDelegatorFactory.sol
Last active May 22, 2019
Deploy (and redeploy) contracts to known addresses
View MetamorphicDelegatorFactory.sol
pragma solidity 0.5.8;
* @title Metamorphic Delegator Factory
* @author 0age
* @notice This contract creates metamorphic contracts, or contracts that can be
* redeployed with new code to the same address. First, it deploys a contract
* with the initialization code of the contract you want to deploy stored in its
* RUNTIME code. Then, it deploys the contract, which retrieves the address of
0age / MetamorphicContractInitCode.txt
Last active Dec 6, 2022
Metamorphic Contract Initialization Code
View MetamorphicContractInitCode.txt
* @title Metamorphic Contract
* @author 0age, derived from cloner contract by @mhswende
* @notice This contract will create a metamorphic contract, or an upgradeable
* contract that does not rely on a transparent proxy, when deployed using
* CREATE2. It expects the deployer to provide a getImplementation() function
* that will return an implementation address, which it will then clone and
* deploy. Unlike with upgradeable transparent proxies, the state of a
* metamorphic contract will be wiped clean with each upgrade. With great power
* comes great responsibility - implement appropriate controls and educate the
* users of your contract if it will be interacted with!
0age / rewardFunction.js
Created Sep 26, 2018
Calculate the reward for creating an upgradeable proxy contract with a given efficient address.
View rewardFunction.js
#!/usr/bin/env node
var Decimal = require('decimal.js') // $ yarn add decimal.js
// pulling out the big guns (maybe a tad excessive...)
precision: 500,
toExpNeg: -500