Skip to content

Instantly share code, notes, and snippets.

View ryley-o's full-sized avatar

ryley-o ryley-o

  • Seattle, WA
View GitHub Profile
@ryley-o
ryley-o / hashSeedToTokenHash.js
Created September 4, 2024 21:51
Convert from hash seed to token hash, js + viem
import { keccak256, encodeAbiParameters, parseAbiParameters } from "viem";
export function hashSeedToTokenHashViem(seedAbiEncoded) {
return keccak256(seedAbiEncoded);
}
// hash seed is arbitrary and can be any bytes12 value except 0x0
const hashSeed = "0x123456789012345678901234";
// encode hash seed in abi format
// @dev in practice, this is right padded w/ 0s to 32 bytes
#!/bin/sh
# Copyright 2020 Docker Compose CLI authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
@ryley-o
ryley-o / half-life-calc.ts
Last active April 25, 2023 17:56
half-life calc for DA Exp
import { BigNumber, utils } from "ethers";
// SUMMARY
// This script calculates the half-life in seconds for a given
// startPrice, endPrice, startTime, and endTime.
// The calculation accounts for the Art Blocks pseudo-exponential pricing curve
// used in DAExp minters.
// INPUTS
const startPrice = utils.parseUnits("10", "ether");
@ryley-o
ryley-o / Script AB Project 412
Created February 15, 2023 02:21
Script for project 412
Comments: This script is minified and very difficult to read. Will likely need help from artist to understand it.
script project 412:
document.body.innerHTML += '<div class=\"tggl\"><span>2d </span><input type=\"checkbox\" id=\"tt\" onclick=\"javascript:window.main.persp=1-window.main.persp\"><label for=\"tt\"><i></i></label><span> 3d</span></div>'\nlet tokenHash = tokenData.hash,_=THREE,de=b=>{var f,o,a,e={},d=b.split(\"\"),c=f=d[0],g=[c],h=o=256;for(b=1;b<d.length;b++)a=d[b].charCodeAt(0),a=h>a?d[b]:e[a]?e[a]:f+c,g.push(a),c=a.charAt(0),e[o]=f+c,o++,f=a;return g.join(\"\")}\nclass Rand{constructor(t){this.ua=0;let sfc32=function(u){let a=parseInt(u.substr(0,8),16),b=parseInt(u.substr(8,8),16),c=parseInt(u.substr(16,8),16),d=parseInt(u.substr(24,8),16);return _=>{;a|=0;b|=0;c|=0;d|=0;let t=(((a+b)|0)+d)|0;d=(d+1)|0;a=b^(b>>>9);b=(c+(c<<3))|0;c=(c<<21)|(c>>>11);c=(c+t)|0;return (t>>>0)/4294967296;};};this.pa=new sfc32(t.substr(2,32));this.pb=new sfc32(t.substr(34,32));for(let i=0;i<1e6;i+=2){this.pa();this.p
@ryley-o
ryley-o / V3-core-gas-profiling-summary.md
Created September 30, 2022 19:43
V3 core gas profiling summary