- Most bifurcated definitions seem to be for reverting vs non-reverting codepaths - ie, normal fulfill vs fulfillAvailable. Introducing branching logic may add gas overhead.
- aggregateAvailable
- callAndCheckStatus (probably)
- fun_getGeneratedOrder (vs others, likely)
- fun_validateOrderAndUpdateStatus (vs others)
- fun_validateOrderAndPrepareToFulfill
- fun_verifyOrderStatus
- fun_verifyTime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# /// script | |
# requires-python = ">=3.7" | |
# dependencies = [ | |
# "pycryptodome>=3.17.0", | |
# ] | |
# /// | |
""" | |
This script processes Solidity (.sol) files to replace lines following |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.17; | |
import {Test} from "forge-std/Test.sol"; | |
address constant callee = address(bytes20("call me maybe")); | |
interface Authorizer { | |
function allowed() external view returns (bool); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# h/t @DrakeEvansV1 & ChatGPT | |
TARGET_SIZE=24.576 | |
MIN_RUNS=1 | |
# NOTE that at time of writing, Etherscan does not support verifying contracts | |
# that specify more than 10,000,000 optimizer runs. | |
# Higher numbers do not always result in different bytecode output. If a | |
# higher number of runs is used, it may be possible verify by spoofing with a | |
# number that results in the same bytecode output. This is not guaranteed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from pprint import pprint | |
defs = [] | |
with open("Seaport.sol") as f: | |
lines = f.readlines() | |
for line in lines: | |
line = line.strip() | |
if line.startswith("function fun_"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########### | |
# Imports # | |
########### | |
# the RPCs file should include RPC URLs and Etherscan API Keys for relevant networks | |
# (in a separate file so they don't get committed) | |
source "$(dirname "$0")/rpcs.sh" | |
# any useful addresses for various networks for easy reference | |
source "$(dirname "$0")/addresses.sh" | |
# any useful functions and definitions for interacting with Seaport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import json | |
from typing import List | |
from web3 import Web3 | |
def calculateSelector(sig): | |
result = Web3.keccak(text=sig) | |
selector = (Web3.toHex(result))[:10] | |
return selector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from "fs"; | |
import * as dotenv from "dotenv"; | |
import { OpenSeaPort, Network } from "opensea-js"; | |
dotenv.config(); | |
const HDWalletProvider = require("@truffle/hdwallet-provider"); | |
const mnemonic = fs.readFileSync(".mnemonic").toString().trim(); | |
const ETH_RPC_URL = process.env.ETH_RPC_URL; |
- Try to use latest version of Solidity (0.8.12 at time of writing) for compiler optimizations, features, and bugfixes
- Consider using a TwoStepOwnable implementation to mitigate the risk of unrecoverable ownership transfers due to user error
- Consider using custom errors instead of
require
statements, which can cut down on contract size and thus deploy gas cost - For token optimizations: consider inheriting from Solmate's (opinionated) token contracts over OpenZeppelin's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### update + upgrade packages first | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
# sudo apt-get install mysql-server --fix-dependencies -y | |
sudo apt-get install tor git htop python3-dev screen libmysqlclient-dev libxml2-dev libxslt1-dev zlib1g-dev -y | |
# install miniconda 3.4.3 | |
wget -O anaconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh |
NewerOlder