Skip to content

Instantly share code, notes, and snippets.

@0xfoobar
0xfoobar / detect-push0-support.js
Created June 25, 2025 17:59 — forked from 0xngmi/detect-push0-support.js
Detect chains that dont support PUSH0
async function detectPush0Support(rpcs) {
return (await Promise.all(rpcs.map(async rpc => {
try {
const res = await fetch(rpc, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"method": "eth_call",
@0xfoobar
0xfoobar / Lambert.sol
Created November 8, 2023 00:05
Lambert W0(x) Function Approximation
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
import {wadLn, unsafeWadMul, unsafeWadDiv} from "solmate/utils/SignedWadMath.sol";
/// @notice Approximated principal branch of [Lambert W function](https://en.wikipedia.org/wiki/Lambert_W_function)
/// @dev Only supports the [1/e, 3+1/e] and [3+1/e, inf] interval
/// @dev Approximate [1/e, 3+1/e] with a lookup table weighted average
/// @dev Approximate and [3+1/e, inf] with ln(x) - ln(ln(x)) + ln(ln(x))/ln(x)
contract Lambert {
@0xfoobar
0xfoobar / FortePair
Created November 17, 2022 16:05
FortePair.sol
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
@0xfoobar
0xfoobar / FortePairFactory.sol
Created August 23, 2022 20:12
FortePairFactory at 0x759e390D946249c63e0A1d8a810C5A577a591719
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
@0xfoobar
0xfoobar / ForteRouter.sol
Created August 23, 2022 19:59
ForteRouter at 0x0e2374110f4Eba21f396FBf2d92cC469372f7DA0
[
{
"inputs": [
{
"internalType": "address",
"name": "_factory",
"type": "address"
},
{
"internalType": "address",
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import {IERC20} from "../interfaces/IERC20.sol";
contract BetEscrow {
event BetOffered(uint betId);
enum Status {
{
"0xAb2e11C99D8830D5d9B2494A565c974595e39eef": [],
"0x94eB448740ff114046d2Dd4A9E7e36Ce25adCC06": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0x94eb448740ff11404-AKX"
],
"0xE9Fb10063CF707EF741Ff7149a27880cE5adB296": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0xe9fb10063cf707ef7-sFF"
],
"0xdFB6B1febdEcBfDCe1014216D5F80BA52109Eb1A": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0xdfb6b1febdecbfdce-kuH"
@0xfoobar
0xfoobar / gist:45959d4508e5a084609542a361c7cb24
Created September 1, 2021 10:41
HDPunks Final Reservation
{
"0xAb2e11C99D8830D5d9B2494A565c974595e39eef": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0xab2e11c99d8830d5d-eh2"
],
"0x94eB448740ff114046d2Dd4A9E7e36Ce25adCC06": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0x94eb448740ff11404-AKX"
],
"0xE9Fb10063CF707EF741Ff7149a27880cE5adB296": [
"https://opensea.io/bundles/hdpunks-reservation-bundle-0xe9fb10063cf707ef7-sFF"
],
const { expect } = require("chai");
describe("NFTOptions", function () {
const penguAddr = "0xBd3531dA5CF5857e7CfAA92426877b022e612cf8";
const penguOwner = "0x2c2c2F6DBe08942280d4F7626b6BAd5C11D20215";
const ids = ["2036", "4205"];
const buyer = "0xe5ee2B9d5320f2D1492e16567F36b578372B3d9F";
const erc721Abi = [
"function approve(address to, uint256 tokenId)"
// SPDX-License-Identifier: GPL-3.0
/**
Cycle through NFTX pools until you find the ID you want
See https://github.com/NFTX-project/x-contracts-private/blob/4650f3cae4c2d776ca45effba65513c9e6ec4b6b/contracts/NFTX.sol
*/