Skip to content

Instantly share code, notes, and snippets.

pragma circom 2.0.0;
include "../node_modules/circomlib/circuits/mimcsponge.circom";
template attestValidMove () {
signal input move;
signal input secret;
signal output moveAttestation;
component mimcAttestation = MiMCSponge(2, 220, 1);
@botdad
botdad / get.sh
Created February 7, 2022 17:50
Top 50 uni v3 pools by TVL
curl 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3' -X POST -H 'content-type: application/json' --data-raw '{"operationName":"topPools","variables":{},"query":"query topPools {\n pools(\n first: 50\n orderBy: totalValueLockedUSD\n orderDirection: desc\n subgraphError: allow\n ) {\n id\n __typename\n totalValueLockedUSD \n }\n}\n"}'
@botdad
botdad / CREATE07Proxy.sol
Created December 22, 2021 19:14
Proof of concept for rewritable data contracts
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.11;
import "./utils/Bytecode.sol";
contract CREATE07Proxy {
error ErrorDestroyingContract();
error ErrorDeployingToDeterministicAddress();
function deployDataContract(bytes memory data) external {
FROM rust as builder
WORKDIR /usr/src/power-clash/
COPY Cargo.toml .
COPY Cargo.lock .
# This is a dummy build to get the dependencies cached.
RUN mkdir src \
&& echo "fn main() {}" > src/main.rs \
&& cargo build --release
@botdad
botdad / getBaseFeeInNextBlock.ts
Created October 1, 2021 16:21
EIP1559 gas math in TS
import { BigNumber } from 'ethers'
const BASE_FEE_MAX_CHANGE_DENOMINATOR = 8
export const getBaseFeeInNextBlock = (
currentBaseFeePerGas: BigNumber,
currentGasUsed: BigNumber,
currentGasLimit: BigNumber
): BigNumber => {
const currentGasTarget = currentGasLimit.div(2)