Skip to content

Instantly share code, notes, and snippets.

@stephancill
stephancill / trace.ts
Last active June 22, 2025 21:18
A function to extract calldata suffix from deeply nested EVM calls
import { createMemoryClient } from "tevm";
import type { Message } from "tevm/actions";
import { createAddress } from "tevm/address";
import {
type Abi,
type Address,
bytesToHex,
type Chain,
decodeEventLog,
decodeFunctionData,

Creation code

const data = getCrowdfundDeploymentData({ name, symbol, creator });

// const humanReadableAbi = new ethersUtils.Interface(
//   CrowdfundFactoryERC20LaunchABI
// );
// const formatted = humanReadableAbi.format("full")[0];
const formatted =
"createERC20LaunchCrowdfund(address crowdfundImpl, tuple(address initialContributor, address initialDelegate, uint96 minContribution, uint96 maxContribution, bool disableContributingForExistingCard, uint96 minTotalContributions, uint96 maxTotalContributions, uint160 exchangeRate, uint16 fundingSplitBps, address fundingSplitRecipient, uint40 duration, address gateKeeper, bytes12 gateKeeperId) crowdfundOpts, tuple(string name, string symbol, uint256 customizationPresetId, tuple(address partyImpl, address partyFactory, address[] hosts, uint40 voteDuration, uint40 executionDelay, uint16 passThresholdBps, uint16 feeBps, address feeRecipient) governanceOpts, tuple(bool enableAddAuthorityProposal, bool allowArbCallsToSpendPartyEth, bool allowOperators, uint
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Permit.sol)
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Permit.sol)
/**
* @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
@stephancill
stephancill / transformHashReverse.ts
Created June 9, 2024 17:43
This function reverses the transformation done by `transformHash` in hub-monorepo
import { base58ToBytes } from "@farcaster/hub-web";
/**
* ~The protobuf format specifies encoding bytes as base64 strings, but we want to return hex strings
* to be consistent with the rest of the API, so we need to convert the base64 strings to hex strings
* before returning them.~
*
* This function reverses the transformation done by `transformHash` in `transformHash.ts`.
*/
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
@stephancill
stephancill / notes.patch
Created January 26, 2024 12:20
atproto repo notes
diff --git a/packages/bsky/src/api/app/bsky/feed/getFeed.ts b/packages/bsky/src/api/app/bsky/feed/getFeed.ts
index 76201531..1720e938 100644
--- a/packages/bsky/src/api/app/bsky/feed/getFeed.ts
+++ b/packages/bsky/src/api/app/bsky/feed/getFeed.ts
@@ -236,6 +236,7 @@ const skeletonToFeedItems = async (
): Promise<FeedRow[]> => {
const { feedService } = ctx
const feedItemUris = skeleton.map(getSkeleFeedItemUri)
+ // This is where URIs are converted to items via the DB
const feedItemsRaw = await feedService.getFeedItems(feedItemUris)
@stephancill
stephancill / smart-order-router.ts
Created January 25, 2024 14:40
A script which generates swap calldata using the uniswap smart order router
import { Protocol } from "@uniswap/router-sdk";
import { Percent, Token, TradeType } from "@uniswap/sdk-core";
import {
AlphaRouter,
AlphaRouterConfig,
CurrencyAmount,
SwapOptions,
SwapType,
nativeOnChain,
} from "@uniswap/smart-order-router";
@stephancill
stephancill / tampermonkey_play_sound_on_element_change.user.js
Created April 17, 2023 13:28
A Tampermonkey userscript that plays a sound when the content of an element found by a user-provided XPath changes. The script is activated using the Ctrl+Shift+X key combination.
// ==UserScript==
// @name Play Sound on Element Change
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Plays a sound when the content of an element with a specific ID changes.
// @author stephancill
// @match *://*/*
// @grant none
// ==/UserScript==
@stephancill
stephancill / ceremony.js
Last active January 25, 2023 15:54
Ethereum KZG Ceremony Lobby Size Scriptable Widget
// Displays the Ethereum KZG ceremony lobby size
// For use in the Scriptable app
// Author: @stephancill
async function getStatus() {
let url = "https://seq.ceremony.ethereum.org/info/status"
let req = new Request(url)
let data = await req.loadJSON()
@stephancill
stephancill / Pipfile
Created January 20, 2023 15:23
SD Wrapper
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
replicate = "*"
flask = "*"
[dev-packages]
//
// TimedActionRepeater.swift
//
// Created by Stephan Cilliers on 2018/06/26.
// Copyright © 2018 Stephan Cilliers. All rights reserved.
//
import Foundation
class TimedActionRepeater {