Skip to content

Instantly share code, notes, and snippets.

View coindegen's full-sized avatar

CoinDegen coindegen

View GitHub Profile
@coindegen
coindegen / question.md
Created August 9, 2023 03:38
zod problem

Hello, I am able to detect and handle ZodErrors in dev mode correctly, but lose this ability in production.

My route:

export function isZodErrorResponse(error: any): error is ZodError {
  console.dir("ZODZOD")
  console.dir(error, { depth: null })
  const isZod = error instanceof ZodError
  console.log({ isZod })
  return isZod
@coindegen
coindegen / normalizeCase.ts
Created September 28, 2022 14:46
replace address with checksum version
import { ethers } from "ethers"
import { MongoClient } from "mongodb"
require("dotenv-safe").config()
const DATABASE_URI = process.env.DATABASE_URI || ""
const DATABASE_NAME = process.env.DATABASE_NAME
async function main() {
try {
let client = new MongoClient(DATABASE_URI)
@coindegen
coindegen / Archetype.sol
Created July 27, 2022 01:16
Archetype contract
// SPDX-License-Identifier: MIT
// Archetype v0.2.0
//
// d8888 888 888
// d88888 888 888
// d88P888 888 888
// d88P 888 888d888 .d8888b 88888b. .d88b. 888888 888 888 88888b. .d88b.
// d88P 888 888P" d88P" 888 "88b d8P Y8b 888 888 888 888 "88b d8P Y8b
// d88P 888 888 888 888 888 88888888 888 888 888 888 888 88888888
// d8888888888 888 Y88b. 888 888 Y8b. Y88b. Y88b 888 888 d88P Y8b.
@coindegen
coindegen / abi.json
Created July 27, 2022 01:14
Archetype ABI
[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceEmpty","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ExcessiveEthSent","type":"error"},{"inputs":[],"name":"InsufficientEthSent","type":"error"},{"inputs":[],"name":"InvalidConfig","type":"error"},{"inputs":[],"name":"InvalidReferral","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"LockedForever","type":"error"},{"inputs":[],"name":"MaxBatchSizeExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintNotYetStarted","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MintingPaused","type
@coindegen
coindegen / .bashrc
Last active July 20, 2022 00:31
vimrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
/**
*Submitted for verification at Etherscan.io on 2020-08-27
*/
pragma solidity ^0.5.0;
contract BuilderShop {
address[] builderInstances;
uint contractId = 0;
@coindegen
coindegen / keybase.md
Created January 31, 2022 05:19
keybase.md

Keybase proof

I hereby claim:

  • I am coindegen on github.
  • I am coindegen (https://keybase.io/coindegen) on keybase.
  • I have a public key ASC0JUIqZJkWX2nT2_uH9VrBGjLlMQm-azHK0Ca_mlZllQo

To claim this, I am signing this object:

@coindegen
coindegen / provenance.js
Created January 29, 2022 12:37
provenance hash
const keccak256 = require("keccak256");
const fs = require("fs");
const chalk = require("chalk");
const path = require("path");
const isLocal = typeof process.pkg === "undefined";
const basePath = isLocal ? process.cwd() : path.dirname(process.execPath);
console.log({ basePath });
const { buildDir } = require(path.join(basePath, "/src/config.js"));
// Read files from the build folder defined in config.
[
{
"name": "Capsule Machine NFT #171",
"description": "The most ambitious crossover event in art history.",
"image": "ipfs://NewUriToReplace/171.png",
"tokenId": 4187,
"artist": "Fresherluke",
"master_collection": "Capsule Machine NFT",
"slave_collection": "Skull-King",
"external_url": "https://www.capsulemachinenft.com/",
{
"makeAsset": {
"assetType": {
"assetClass": "ERC20",
"contract": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1"
},
"value": "5000"
},
"maker": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"takeAsset": {