Skip to content

Instantly share code, notes, and snippets.

View wschwab's full-sized avatar
🚀

William Schwab wschwab

🚀
View GitHub Profile
@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 / 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 / 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 / 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 / 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

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: