Skip to content

Instantly share code, notes, and snippets.

View snowkidind's full-sized avatar
💭
Was informed that there is a special place in hell for pureJS maximalists....

Keny Ruyter snowkidind

💭
Was informed that there is a special place in hell for pureJS maximalists....
View GitHub Profile
@snowkidind
snowkidind / index.js
Created October 31, 2023 12:27
image bot - cronjob to send an image to your telegram room on an interval
const env = require('node-env-file')
env(__dirname + '/.env')
const fs = require('fs')
const TelegramBot = require('node-telegram-bot-api')
const bot = new TelegramBot(process.env.TELEGRAM_API_KEY, { polling: true })
const room = process.env.TELEGRAM_ROOM
const imgDir = __dirname + '/img/'
const appdata = __dirname + '/appdata/'
// mkdir img -> upload image files here
52: 0xeae4c727ea43990ea92f427da36ddff8e72f6854 COCO-WETH
select pool by index
> 52
Number of results to display: (enter to default to 100)
> 500
Early Uniswap Traders. Displaying 500 results:
Ripper: Getting pool transactions...
Erigon: Getting transaction information...
Node: Checking Account Balances and resolving Names...
0x2C5B7742840E243FcEb567438c9A5921FffB33aC 14,620,345,438,705.55
@snowkidind
snowkidind / erigon_ws.js
Created March 14, 2023 15:41
Connect to erigon websocket and filter by some addresses you want to watch.
const ethers = require("ethers")
const wsProvider = new ethers.providers.WebSocketProvider("http://YOURWSURLHERE")
// these are most popular addresses, note all lower cased
const watchList = [
"0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH
"0x7a250d5630b4cf539739df2c5dacb4c659f2488d", // Uniswap V2: Router 2
"0xea674fdde714fd979de3edf0f56aa9716b898ec8", // Ethermine
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC
ContractAddress TokenName TokenSymbol holder count transfer count # of times appears in list notes
0x420b595d8b648971b3bfcf46e66544c384860536 VenmoCash VMO 1 6 2
0xdeeb40536e94be7226b77fb89d7d3cd65a82fb85 Zoom Protocol ZOM 1 9 2
0xe670848d54788997942ecf938cd23b09550bae73 TARO TARO 1 4 2
0xf28fec34928a1dc19b650104ae082665b66f720e ETH/BTC Long-Only Alpha XTF.SWCEBL 1 4 2
0x030385efc63ebda6021d9098b1fcc422547d83d3 Tacos @ Taconomics.io $TACO 2 5 2
0x03bb9bbf0423e44370e88ec5fc31eecf4e2b4ac2 STVKE.Network STV 2 9 2
0x05e850909664a3cf926ca4777c3ec1577d36ec18 OnFlow Flow 2 8 2
0x06ca771a689d6d5f5e435be2ef1d1ffc6bdb3b4c Wing Token WING 2 8 2
0x08a958bdc9e0beb0c3ee2ec6e9c0013f14ce66e5 Harold Returns KEKW 2 6 2
@snowkidind
snowkidind / trace.js
Created March 12, 2023 13:28
Working on keeping eth balances via erigon trace api
// NOTICE NOTHING SPECIAL NOR PRETTY JUST EXAMPLE HACKING AT PRESENT
const env = require('node-env-file')
env(__dirname + '/.env')
const ethers = require('ethers')
const { multiEth, decimals } = require('./utils')
const { d } = decimals
const provider = multiEth.getProvider('mainnet')
@snowkidind
snowkidind / coder.js
Last active December 30, 2022 05:45
Node: Encrypt and Decrypt a file starting point
const crypto = require('crypto')
const fs = require('fs')
// Higher number decreases the probability that n can be brute forced
// iterations is the number of steps to use to derive a new key. This is intended to scale over time based on the power of cpus
const pbkdf2iterations = 106667
const encryptionKey = 'blahblahblahttayakaewpleng'
@snowkidind
snowkidind / RouterDifferences.sol
Last active July 23, 2022 05:54
RouterDifferences.sol - Differences between Uniswap v3 routers SwapRouter and SwapRouter02
// SPDX-License-Identifier: UNLICENSED" for non-open-source code
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import '@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol';
import '@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol';
// The SwapRouter02 (1.1.0) router combines v2 and v3 pools. There isnt a good doc that explains when to use
// it vs the SwapRouter contract. The 02 paramaters arent the same as the imported libraries, to use the
// ISwapRouter02 contract, create your own interface.
// Note: Not sure how the other methods are but I suspect similar, untested
const env = require('node-env-file')
env(__dirname + '/../.env')
const { ethers, BigNumber } = require('ethers')
const { dbCurrency } = require('../db')
const { multiEth, dateutils, decimals } = require('../utils')
const { round, weiToDisplay, displayToWei, bigD, d } = decimals
const { getProvider, newSigner } = multiEth
const provider = getProvider('mainnet')
const quoterAbi = require('../utils/lib/uniswapQuoter.json')
Using const { AlphaRouter } = require('@uniswap/smart-order-router')
when calling
const wei = ethers.utils.parseUnits('100', 6)
const inputAmount = CurrencyAmount.fromRawAmount(USDC, jsbi.BigInt(wei)) // Note inputAmount contains its own JSBI's created by uniswap code which appear to be the source of the error
const route = await router.route(
inputAmount,
UNI,
TradeType.EXACT_INPUT,
{
// load solana transactions into the database
const env = require('node-env-file')
env(__dirname + '/../.env')
const solscan = require('../external/solscan.js')
const { dbLocation, dbChainTx, dbChainTxSync, dbSplAccount, dbKnownWallets } = require('../db')
const { dateutils, decimals, signal, utils } = require('../utils')
const { timeFmtDb, dateNowUTC } = dateutils
const { weiToDisplay, bigD } = decimals