Skip to content

Instantly share code, notes, and snippets.

View wschwab's full-sized avatar
🚀

William Schwab wschwab

🚀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am wschwab on github.
  • I am wschwab (https://keybase.io/wschwab) on keybase.
  • I have a public key ASCLQsTdbely_XyflaFGm4npDO3I2bHuppYfDhiAYvrWIAo

To claim this, I am signing this object:

@wschwab
wschwab / geth.service
Created November 4, 2019 13:37
a sample script to create a service for running a geth node
[Unit]
Description=Geth Node
After=network.target auditd.service
Wants=network.target
[Service]
WorkingDirectory=/home/pi
ExecStart=/usr/local/bin/geth --syncmode fast --cache 256 --datadir /mnt/ssd/ethereum
User=pi
Group=pi
Restart=always
@wschwab
wschwab / get_involved.md
Last active November 14, 2019 09:56
Rough draft for a 'Get Involved' page

Get Involved

Want to get involved in the Ethereum ecosystem? This page will give you some ideas and some resources.

We're going to divide this page into technical, research, and non-technical categories.

Technical

Run a node

@wschwab
wschwab / eventFilter.js
Last active August 22, 2023 07:41
a handmade Ethereum event filter that you should never really use
const eventFilter = (contractAddress, contractAbi, eventName, _provider) => {
const provider = _provider
// this will return an array with an object for each event
const events = contractAbi.abi.filter(obj => obj.type ? obj.type === "event" : false);
// getting the Transfer event and pulling it out of its array
const event = events.filter(event => event.name === eventName)[0];
// getting the types for the event signature
const types = event.inputs.map(input => input.type)
// knowing which types are indexed will be useful later
let indexedInputs = [];
@wschwab
wschwab / eventFilterWithPagination.js
Created August 24, 2020 14:57
an attempt at implementing some kind of pagination to an Ethereum event filter
const eventFilterv5WithPagination = (contractAddress, erc20abi, _provider, numberOfResponses) => {
// creating the interface of the ABI
const iface = new ethers.utils.Interface(erc20abi.abi);
// intialize array for the logs
let logs = [];
// get latest block number
const latest = await provider.getBlockNumber();
// intialize a counter for which block we're scraping starting at the most recent block
let blockNumberIndex = latest;
@wschwab
wschwab / stEthToYearn.ts
Created March 24, 2022 10:37
rough draft attempt to get from stEth to providing LP tokens to Yearn's new Rocket Pool vault - THIS MIGHT NOT WORK USE AT YOUR OWN RISK
import { Contract, Provider } from "ethers-multicall";
import { ethers } from 'ethers';
import { JsonFragment } from "@ethersproject/abi";
import { crvAbi } from './abis/crv';
import * as wstEthAbi from './abis/wsteth.json';
import * as yAbi from './abis/yAbi.json';
import * as erc20Abi from "../artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json"
const provider = new ethers.providers.AlchemyProvider("mainnet", process.env.ALCHEMY_API);
@wschwab
wschwab / attestation.txt
Created April 6, 2022 18:41
Attestation
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 115
Hash: 64847d4e 8039c69f cb7e10d4 70cce69b
ce51f7e7 0594d438 5abc7c05 8e2f4ec4
4203e983 8716a6aa 699d4cf8 591fb6fe
c48d4358 554152dc cc7e925c 3abb8cc6
@wschwab
wschwab / attestation.txt
Created April 7, 2022 05:47
Attestation
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore31
Contributor # 111
Hash: c25fd0e8 6694134a d814167c c711f142
8eac878c 4cd57284 82863ad6 3cf94f7c
992a1d32 fe19d06f 3f8085c1 0486d1ae
aa6493c8 670871f3 f2a8ad8c 9ad302f9
@wschwab
wschwab / contracts...Interview.sol
Last active May 30, 2022 13:42
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
struct GLOBALS {
uint256 PRICE;
uint256 MAX_PER_ADDRESS;
address OWNER;
@wschwab
wschwab / ZeroXa57.sol
Last active October 31, 2022 17:25
Rough reconstruciton of the source code for the contract at 0xa57Bd00134B2850B2a1c55860c9e9ea100fDd6CF on eth mainnet
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// current thinking is that the original was compiled on 0.5.0 or 0.5.1
// after seeing significant code reuse from DSProxy, assumptions have been made
// the presence of cache() and setCache() imply usage of DSProxyCache
interface DSProxyCache {
function read(bytes memory _code) external view returns (address);