Skip to content

Instantly share code, notes, and snippets.

View cleancoindev's full-sized avatar
🦦
OtterMarkets eh? *rolls eyes*

cleancoindev

🦦
OtterMarkets eh? *rolls eyes*
View GitHub Profile
https://medium.com/pinata/how-to-build-substack-on-ipfs-a940a5caf812
const util = require('ethereumjs-util')
const Wallet = require('ethereumjs-wallet')
var possible = 'abcdef1234567890'
var basePrivateKey = '1cd3b30424316919712c48359829787eefa0d724a78274a506530dbb72'
var charsMissing = 64 - basePrivateKey.length
var targetPublicAddress = ' 0xe8Ca70C909905Ebbbe6a49c34797beF31d895241'
var missingPart = '';
for (var i = 0; i < charsMissing; i++) {
missingPart = missingPart.concat('f');
We can't make this file beautiful and searchable because it's too large.
Note: For the actual contract source codes use the api endpoints at https://etherscan.io/apis#contracts
"Txhash","ContractAddress","ContractName"
"0x85da5f1e3d93f380674e2210416a552dd5520ec2785c16261f950e66c4321209","0x4b4701f3f827e1331fb22ff8e2beac24b17eb055","DISTX"
"0xd9bfae78b0dc777897a0e99bef998f1a3e89317e4849c9379a9c7c6613ace799","0xf58f90cb329f812f6d7c5a7b14ffccacbe9c034e","CurveVestingAdapter"
"0xacc4508639baad1b5d420948c1bca652df2f23e24af441d319b8f90ad4c1e15d","0xb2133d170b3bcab71358fc4eb2f95a384e5d328a","NexusStakingAdapter"
"0xf663b37dc0d975b1cb5f3bf74f476553da87bbf5fbd1573a2ede00f6ed18d847","0x303baa149efc0b3b47136177f27637f2c491e457","WalletImpl"
"0x18d1bff8ef51ffbbd388603b7550dc3de7ee99029569b65978bceb32b1f09778","0x8fd3d838ffceeb4ff4dd5b0221a99c3b1ddb9ac9","UniswapV2PriceOracle"
"0xd4bf1b6d87efa8d80dbce498113e7439cd901779ff2e23903204ff7456be11b6","0x7f628bdabde2c6c4cfc57f3f7683cd6034054e3a","OfficialGuardian"
"0xb2f9b7791021bca921f9ba9f3d9bc1513a637796fa8fe6de73b91c86f2585fef","0x035f99A18114621
/// @dev given a number get a slice of any bits, at certain offset
/// @param _n a number to be sliced
/// @param _nbits how many bits long is the new number
/// @param _offset how many bits to skip
function _sliceNumber(uint256 _n, uint256 _nbits, uint256 _offset) private pure returns (uint256) {
// mask is made by shifting left an offset number of times
uint256 mask = uint256((2**_nbits) - 1) << _offset;
// AND n with mask, and trim to max of _nbits bits
return uint256((_n & mask) >> _offset);
}
@cleancoindev
cleancoindev / ethernalsale.js
Created February 4, 2021 00:38 — forked from alexvandesande/ethernalsale.js
This is a first draft at what could be a continuous token sale. I just wrote it and haven't tested it but it shows the proof of concept: tokens are continuously generated in any curve desired and sold for the highest bidder. Since there's a maximum token sale speed, this guarantees that sales can't end too quickly. Since the sale always starts f…
pragma solidity ^0.4.2;
contract ethernalSale {
struct order {
uint amount;
address buyer;
}
mapping (uint => order) orderBook;
mapping (address => uint) balanceOf;
@cleancoindev
cleancoindev / btcaud_hourly.py
Created January 13, 2021 06:57 — forked from cryptoscopia/btcaud_hourly.py
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.
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
@cleancoindev
cleancoindev / dydxFlashLoanTemplate.sol
Created January 13, 2021 06:55 — forked from cryptoscopia/dydxFlashLoanTemplate.sol
A single-file simplest possible template for a contract that obtains a flash loan from dydx, does things, and pays it back.
// 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 }
@cleancoindev
cleancoindev / sugh.sh
Created July 2, 2020 07:06 — forked from erdincay/sugh.sh
su GitHub (downloading all repositories from a given user)
#!/bin/bash
if [ -z "$1" ]; then
echo "waiting for the following arguments: username + max-page-number"
exit 1
else
name=$1
fi
if [ -z "$2" ]; then
@cleancoindev
cleancoindev / supply-erc20-via-solidity.js
Created March 24, 2020 19:29 — forked from ajb413/supply-erc20-via-solidity.js
Redeem your c-Token back into underlying asset.
// Call redeem based on a cToken amount
const amount = web3.utils.toHex(cTokenBalance * 1e8);
const redeemType = true; // true for `redeem`
// Call redeemUnderlying based on an underlying amount
// const amount = web3.utils.toHex(balanceOfUnderlying);
// const redeemType = false; //false for `redeemUnderlying`
// Retrieve your asset by exchanging cTokens
console.log('Redeeming the cDAI for DAI...');
// Mint some cDAI by sending DAI to the Compound Protocol
console.log('MyContract is now minting cDAI...');
let supplyResult = await myContract.methods.supplyErc20ToCompound(
daiMainNetAddress,
compoundCDaiContractAddress,
web3.utils.toHex(10e18) // 10 DAI to supply
).send({
from: myWalletAddress,
gasLimit: web3.utils.toHex(5000000), // posted at compound.finance/developers#gas-costs
gasPrice: web3.utils.toHex(20000000000), // use ethgasstation.info (mainnet only)