Skip to content

Instantly share code, notes, and snippets.

View adrianmcli's full-sized avatar
:shipit:
What's happening?

Adrian Li adrianmcli

:shipit:
What's happening?
View GitHub Profile
@adrianmcli
adrianmcli / rln-trusted-setup-ceremony_attestation.log
Created August 1, 2023 06:02
Attestation for RLN Trusted Setup Ceremony MPC Phase 2 Trusted Setup ceremony
Hey, I'm adrianmcli-943555 and I have contributed to the RLN Trusted Setup Ceremony MPC Phase2 Trusted Setup ceremony.
The following are my contribution signatures:
Circuit # 1 (rln-withdraw)
Contributor # 8
Contribution Hash: ebbe0047 4d2bdce5 30dc5990 c271462f
aba6770d c33abf4c 17698c9e 1d35d8de
91a73ef3 324f0899 1b741bc0 8ce05488
5a6287e7 953f958f d2510682 8d974c2b
@adrianmcli
adrianmcli / BASK_PID_UMIP_DRAFT.md
Created May 16, 2021 01:29
Draft UMIP for BASK's KPI Options

HEADERS

UMIP-XX
UMIP Title Add BASKUSD and BDIDPI_MCAP_DIFF as supported price identifiers
Authors Adrian Li
Status Draft
Created 2021-05-15
Discourse Link INSERT DISCOURSE LINK HERE
@adrianmcli
adrianmcli / complicated_topic_prompt.md
Created June 11, 2020 15:21
A place to gather our thoughts regarding Complicated Topic

Complicated Topic

This topic is quite complicated and warrants a discussion with the public that is long-form and persistent.

Rationale

While a full forum would be helpful, a gist thread like this is more of a one-off approach to gather ideas in a persistent and long-form manner.

Usage

@adrianmcli
adrianmcli / getABIs.js
Created May 12, 2020 00:56
Grab JSON artifacts and extract the ABIs from them into a new folder
const path = require("path");
const fs = require("fs");
// get JSON artifact files
const artifactDir = path.join(__dirname, "build/contracts/");
const files = fs.readdirSync(artifactDir);
const jsonFiles = files.filter(x => x.slice(-4) === "json");
console.log(jsonFiles.length, "json files found");
@adrianmcli
adrianmcli / _README.md
Last active August 14, 2023 17:19
Files in EthereumBook containing reference to Truffle products

The following commands were run to find the number of files related to Truffle products based on a case-insensitive search:

➜  ethereumbook git:(develop) ✗ git grep -i --files-with-matches 'truffle' | wc -l
      51
➜  ethereumbook git:(develop) ✗ git grep -i --files-with-matches 'ganache' | wc -l
      13
➜  ethereumbook git:(develop) ✗ git grep -i --files-with-matches 'drizzle' | wc -l
       0
@adrianmcli
adrianmcli / web3_error_log.txt
Created November 5, 2019 20:06
Error log from Web3.js install on Node v13
> keccak@1.4.0 install /Users/adrianli/dev/temp/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."
> keccak@1.4.0 rebuild /Users/adrianli/dev/temp/node_modules/keccak
> node-gyp rebuild
CXX(target) Release/obj.target/keccak/src/addon.o
../src/addon.cc:37:47: error: too few arguments to function call, single argument 'context' was not specified
unsigned int rate = info[0]->IntegerValue();
@adrianmcli
adrianmcli / counter-composition.js
Last active February 5, 2019 13:23
An example of using plain functions and composing them to make state containers.
// state container definition
const useState = initVal => {
let val = initVal;
const get = () => val;
const set = x => (val = x);
return Object.freeze({ get, set });
};
@adrianmcli
adrianmcli / counter.js
Created January 6, 2019 10:30
Example of encapsulating state with a function that return objects.
const makeCounter = (initVal = 0) => {
let count = initVal;
const get = () => count;
const set = x => (count = x);
const inc = () => count++;
const dec = () => count--;
return Object.freeze({
get,
@adrianmcli
adrianmcli / compile.js
Last active September 29, 2022 14:33
Programmatically compile and deploy Solidity smart contracts for your tests
const path = require("path");
const fs = require("fs");
const TruffleCompile = require("truffle-compile");
// Promisify truffle-compile
const truffleCompile = (...args) =>
new Promise(resolve => TruffleCompile(...args, (_, data) => resolve(data)));
const compile = async filename => {
const sourcePath = path.join(__dirname, "../contracts", filename);
const Web3 = require("web3") // import web3 v1.0 constructor
// use globally injected web3 to find the currentProvider and wrap with web3 v1.0
const getWeb3 = () => {
const myWeb3 = new Web3(web3.currentProvider)
return myWeb3
}
// assumes passed-in web3 is v1.0 and creates a function to receive contract name
const getContractInstance = (web3) => (contractName) => {