Skip to content

Instantly share code, notes, and snippets.

@cryptoscopia
cryptoscopia / dydxFlashLoanTemplate.sol
Created Oct 21, 2020
A single-file simplest possible template for a contract that obtains a flash loan from dydx, does things, and pays it back.
View dydxFlashLoanTemplate.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
// The ABI encoder is necessary, but older Solidity versions should work
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// These definitions are taken from across multiple dydx contracts, and are
// limited to just the bare minimum necessary to make flash loans work.
library Types {
enum AssetDenomination { Wei, Par }
@cryptoscopia
cryptoscopia / btcaud_hourly.py
Created Jul 4, 2018
A script to fetch hourly historic price data for the last financial year for BTC/AUD, using the CryptoCompare API and save it as CSV.
View btcaud_hourly.py
from __future__ import print_function
import requests
data = []
timestamp = 1530367200 # 2018-07-01 00:00 AEST
for t in range(1530367200, 1530367200-365*24*60*60, -2001*60*60):
data = requests.get(
'https://min-api.cryptocompare.com/data/histohour?fsym=BTC&tsym=AUD&toTs=%s&limit=%s' \
% (t, min(365*24-len(data), 2000))
).json()['Data'] + data
View keybase.md

Keybase proof

I hereby claim:

  • I am cryptoscopia on github.
  • I am cryptoscopia (https://keybase.io/cryptoscopia) on keybase.
  • I have a public key ASBGZs2T8s_oxzwUgg_oECOFm8Ypt4WPTKdNlrmRbShKywo

To claim this, I am signing this object:

@cryptoscopia
cryptoscopia / pwoh_graph_api.py
Created Jan 29, 2018
Parse Etherscan API transaction lists into a CSV of cumulative incoming, outgoing, and total values
View pwoh_graph_api.py
#!/usr/bin/env python
from __future__ import print_function
import argparse
from collections import OrderedDict
from datetime import datetime, timedelta
from decimal import Decimal
import json
parser = argparse.ArgumentParser()
@cryptoscopia
cryptoscopia / pwoh_graph.py
Created Jan 29, 2018
Parse CSV exports of Etherscan transactions into one graph-friendly CSV file
View pwoh_graph.py
#!/usr/bin/env python
from __future__ import print_function
import argparse
from collections import OrderedDict
import csv
from datetime import datetime, timedelta
from decimal import Decimal
parser = argparse.ArgumentParser()