Skip to content

Instantly share code, notes, and snippets.

View jjgonecrypto's full-sized avatar
🔗
Eth wrangling.

j-j.eth jjgonecrypto

🔗
Eth wrangling.
View GitHub Profile
@jjgonecrypto
jjgonecrypto / gnosis-safe-multisend-submitter.js
Created September 21, 2021 11:47
Programmatically submit multiple transactions to a gnosis safe to be signed as one
// Extrapolated from https://github.com/gnosis/safe-core-sdk
const ethers = require('ethers');
const { EthersAdapter } = require('@gnosis.pm/safe-core-sdk');
const Safe = require('@gnosis.pm/safe-core-sdk').default;
const SafeServiceClient = require('@gnosis.pm/safe-service-client').default;
const providerUrl = '....';
@jjgonecrypto
jjgonecrypto / migration.sol
Last active June 23, 2021 21:39
Example Synthetix migration
pragma solidity ^0.5.16;
import "./BaseMigration.sol";
import "../ReadProxy.sol";
import "../AddressResolver.sol";
import "../ProxyERC20.sol";
import "../Proxy.sol";
import "../ExchangeState.sol";
import "../SystemStatus.sol";
import "../legacy/LegacyTokenState.sol";
did:3:bafyreiayxzt7e3v42k6wfgnbciqj6u2fxrarbjgjdh26z5ifqlwlstxlr4
@jjgonecrypto
jjgonecrypto / populate-historic.js
Last active May 10, 2020 16:44
A JSON file of historic versions of Synthetix
'use strict';
const fs = require('fs');
const path = require('path');
const util = require('util');
const execFile = util.promisify(require('child_process').execFile);
const commander = require('commander');
const program = new commander.Command();
@jjgonecrypto
jjgonecrypto / git-file-history.sh
Created May 9, 2020 23:37
Git: get historical versions of a filepath: adapted from https://stackoverflow.com/a/41834486/794170
#!/bin/bash
# we'll write all git versions of the file to this folder:
EXPORT_TO=/tmp/all_versions_exported
# take relative path to the file to inspect
GIT_PATH_TO_FILE=$1
# ---------------- don't edit below this line --------------
@jjgonecrypto
jjgonecrypto / README.md
Last active April 18, 2020 21:36
Buidler v Truffle on Synthetix
@jjgonecrypto
jjgonecrypto / git-delete-squashed.sh
Created March 11, 2020 16:20
git-delete-squashed
#!/bin/sh
# adapted from https://github.com/not-an-aardvark/git-delete-squashed
function git-delete-squashed() {
BASE_BRANCH=${1:-master}
git checkout -q $BASE_BRANCH &&
git for-each-ref refs/heads/ "--format=%(refname:short)" |
while read branch;
do mergeBase=$(git merge-base $BASE_BRANCH $branch) && [[ $(git cherry $BASE_BRANCH $(git commit-tree $(git rev-parse $branch\^{tree}) -p $mergeBase -m _)) == "-"* ]] &&
git branch -D $branch;
@jjgonecrypto
jjgonecrypto / snippets.js
Created February 12, 2020 00:11
JS snippets
{
/*
// Place your snippets for JavaScript React here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
window.snxData=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catc
@jjgonecrypto
jjgonecrypto / sub.js
Last active December 1, 2019 23:33
Synthetix subgraph websocket
'use strict';
const WebSocket = require('ws');
const client = new WebSocket('wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges', [
'graphql-ws',
]);
client.on('open', () => {
console.log('open');