Skip to content

Instantly share code, notes, and snippets.

Inter Protocol Digrams

vaultInstance overview

flowchart TD
        %%{ init: { 'flowchart': { 'curve': 'monotoneY' } } }%%

subgraph vaultFactory[Vault Factory]
    direction BT
    vfT1[The vaultFactory owns a number of VaultManagers and a mint for Minted] ---> vfT2
    vfT2[vaultFactory is a 'Vault Director Machine'  <br/> <br /> - it creates the vaultDirector  </br> - vaultDirector is root user] --> vfT3

Keybase proof

I hereby claim:

  • I am tgrecojs on github.
  • I am tgrex (https://keybase.io/tgrex) on keybase.
  • I have a public key ASA5uPWzWkk7TmfvtMAuxDOTC_VyWc3hNLybADS0Hgyyawo

To claim this, I am signing this object:

// Better way
const getValue = ({value}) => value;
const add = x => y => x + y;
const addTen = add(10);
const multiply = x => y => x * y;
const displayValue = string => value => `${string}::${value}`;
const displayLeverageRatio = displayValue('Leverage Ratio');
const Either = (() => {
const Right = x => ({
chain: f => f(x),
ap: other => other.map(x),
alt: other => Right(x),
extend: f => f(Right(x)),
concat: other =>
other.fold(
x => other,
y => Right(x.concat(y)),
@tgrecojs
tgrecojs / UniV3SwapAnalytics.js
Last active August 31, 2021 18:58
JS code for calculating price impact of ETH/USDC swaps
import sampleData from './sampleData.js';
/**
* Uniswaph V3 Subgraph Data
*
* Result of Qu
*/
const queries = {
swaps: `{
swaps(first: 20, where: {pool:

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@tgrecojs
tgrecojs / drive_sync_settings.sh
Created December 13, 2020 05:46
bash script for excluding
#!/usr/bin/env bash
set -e # always immediately exit upon error
# directory config. ending slashes are important!
# src_dir="$HOME/Projects/"
gdrive_projects-dir="$HOME/Google\ Drive/cloud-based-demo-applications"
# run the sync
rsync -ar --delete \
const Day = ({ get, left, right }) => {
const map = f => Day ({
get: f (extract()),
left, right
})
const extend = f =>
Day ({
get: (left, right) => f (Day ({ get, left, right })),
const Maybe = {
Just: value => ({
value,
map: f => Just(f(value)),
toString: () => `Just(${value})`
}),
Nothing: (value = null) => ({
value: null,
map: f => Nothing(null),
toString: () => `Nothing(${value})`