Skip to content

Instantly share code, notes, and snippets.

View andywer's full-sized avatar

Andy Wermke andywer

View GitHub Profile
@andywer
andywer / delegated-aml.md
Last active June 19, 2023 09:21
Draft: Delegating AML to DeFi pools

Draft: AML Delegation to DeFi Pools

There is a looming risk in DeFi concerning real-world assets (RWAs) or security tokens in general and pools holding them (think Uniswap, AAVE, …) regarding Anti Money Laundering (AML) regulation.

Should a court order the token issuer (i.e. Circle) to freeze the holdings of an address that has deposited the funds into a pool (i.e. UniV3-ETH/USDC), that might risk the token issuer having to freeze the whole pool's holdings.

This risk is even amplified in the new Uniswap v4 architecture as all pools' funds will be held

@andywer
andywer / custom-sep-7-types.md
Last active March 17, 2021 16:02
SEP-7 Stellar URI extension / custom types

New / Custom SEP-7 URI Types

WHOIS (vendor prefixed)

Stellar URI type to request another party's public key. Can optionally be signed with a HMAC using a secret nonce to protect the response (the data submitted to the callback endpoint) against man-in-the-middle attacks.

web+stellar+solarwallet.io:whois?callback=url:<href>[&secret=<nonce>][&msg][&network_passphrase][&origin_domain][&signature]
@andywer
andywer / Dockerfile
Created December 30, 2019 17:08
Database migration & seeding tool / container
FROM node:12-alpine AS builder
COPY . /app
WORKDIR /app
RUN yarn
# `build` script is already run as a `prepare` script hook
RUN rm -rf /app/node_modules
@andywer
andywer / auth.js
Created December 28, 2019 07:44
threads.js super simple hashing example
const sha256 = require("js-sha256")
const { expose } = require("threads/worker")
expose({
hashPassword(password, salt) {
return sha256(password + salt)
}
})
@andywer
andywer / init.sh
Created December 16, 2019 15:52
Git clone candy dispenser
cd /opt
git clone git@github.com:satoshipay/stellar-candy-dispenser.git
@andywer
andywer / sample-config.env
Created December 16, 2019 15:51
Candy Dispenser Sample Config
ACCOUNT_PUBLIC_KEY_1=GACEH4IGNPVQNPPOFC4SLZ5OGCIRPSOFNQIO2XIF5ERUKNYI6QDJ3O6Q
ACCOUNT_PUBLIC_KEY_2=GBZYXXFSOP545IVUAFUQCJVZ42EWGAKEIW5WKP7QPRAIQ5W2NSAUEP5K
TEST_PUBLIC_KEY_1=GC3QAQTZMVUDCU4M3HT3MIIJPS7YC5NFZP3G5S2RBABXP3L4ODZMSWLO
TEST_PUBLIC_KEY_2=GCGKEIISGVAMW4EQYTCM7GLDFBFNEXP6CZXFA5GBZG7CPJOTR2JZGLTA
# <speed>:<duration>:<alternations>
MOTOR_CONFIG_LEFT=30:2s:1 # This motor config is good for M&Ms
MOTOR_CONFIG_RIGHT=40:4.5s:3 # Pistachios
@andywer
andywer / hello-worker.js
Created September 7, 2019 16:15
Hello world threads.js worker (compiled)
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
@andywer
andywer / preauthed-multisig.md
Created July 27, 2019 13:48
Stellar Pre-Authorized Multi-Signature

Stellar Pre-Authorized Multi-Signature

Abstract

I tried to use pre-authorizeded transactions on Stellar as a replacement for a co-signer signature, but it seems like they don't play terribly well with multi-signature setups.

Scenario

Given:

@andywer
andywer / sharded-key-storage.md
Last active March 17, 2021 16:04
Sharded Key Storage

Sharded Secret Key Storage

  • Store secret keys on the internet
  • Authenticate with arbitrary authentication methods to retrieve secret
  • Trustless: None of the key storage server providers can read the secret
  • Recoverable funds: Even if authentication credentials are lost, the secret can be recovered
  • Secure: If a key storage server gets compromised, the attacker will not even know a fragment of the secret
  • Fault-tolerant: Redundancy fragment allows retrieving the secret even if a server is down
  • Versatile: Allows storage of arbitrary secrets
@andywer
andywer / _readme.md
Last active March 7, 2024 05:52
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution