Skip to content

Instantly share code, notes, and snippets.

View Alexintosh's full-sized avatar
🧑‍🍳
Baking

Alessio Delmonti Alexintosh

🧑‍🍳
Baking
View GitHub Profile
@gorgos
gorgos / ExampleSlidingWindowOracleDaiWethKovan.sol
Created January 9, 2021 20:16
ExampleSlidingWindowOracle with DAI + WETH for Kovan.
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol";
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/FixedPoint.sol";
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/FullMath.sol";
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/Babylonian.sol";
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/BitMath.sol";
library SafeMath {
def isWrapPair(equivalentSets, tokenA, tokenB):
for equivalentSet in equivalentSets:
if ((tokenA in equivalentSet) and (tokenB in equivalentSet)):
return True
return False
equivalentSets = [
["WETH", "aETH", "cETH", "iETH", "iETH", "PETH"], # ETH group
["DAI", "aDAI", "cDAI", "dDAI", "iDAI", "yDAI", "rDAI", "CHAI"], # DAI group
["USDC", "aUSDC", "cUSDC", "dUSDC", "iUSDC", "yUSDC"] # USDC group
@allenday
allenday / gini-balance-erc20.sql
Created January 31, 2019 10:14
Calculate Gini coefficient for ERC-20 balances.
with
double_entry_book as (
-- debits
select to_address as address, CAST(value AS NUMERIC) as value, block_timestamp
from `bigquery-public-data.crypto_ethereum.token_transfers`
where from_address is not null and to_address is not null
and token_address = LOWER('0x408e41876cccdc0f92210600ef50372656052a38') --OMG
union all
-- credits
select from_address as address, -CAST(value AS NUMERIC) as value, block_timestamp
@lrettig
lrettig / iceage.py
Created January 18, 2019 15:03
Simulation script for ice age block times
# Date, blocknum, difficulty as of 2019-01-18
# Script by vbuterin, slightly modified by lrettig
import random
import datetime
import sys
def calc_bomb(i):
period = i // 100000
if (period > 0):
# Subtract 2, this is the original formula
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@mikhaildobs
mikhaildobs / InviteLink.sol
Last active January 22, 2019 10:44
InviteLink module for ERC-1077
@tschubotz
tschubotz / gnosis_safe_developer_resources.md
Last active January 15, 2021 16:11
Gnosis Safe - Developer Resources and links
@dappvolume
dappvolume / submit-dapp.md
Last active May 3, 2019 14:58
Submit Dapps to these sites for huge exposure!

Submit A Dapp

Once you create a dapp its important the dapp gets exposure. Here is a list of 20 places you can submit your Dapp.

Dapp Websites

The following websites showcases dapps ( decentralized applications ).

Name URL Platform
@dominiek
dominiek / IDEX.sol
Created February 8, 2018 07:36
IDEX Smart Contract
pragma solidity ^0.4.16;
contract Token {
bytes32 public standard;
bytes32 public name;
bytes32 public symbol;
uint256 public totalSupply;
uint8 public decimals;
bool public allowTransactions;
mapping (address => uint256) public balanceOf;
@erikyuntantyo
erikyuntantyo / react-native-offline-bundling-android
Last active October 29, 2023 06:36
Build react-native offline bundling into android
# create assets folder in the current project
$ mkdir android/app/src/main/assets
# create bundle script
$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
# execute command to run android to create debug apk
$ react-native run-android
# Or change to android folder