Skip to content

Instantly share code, notes, and snippets.

View Linch1's full-sized avatar
💭
I may be slow to respond.

Linch1

💭
I may be slow to respond.
View GitHub Profile
@Linch1
Linch1 / restarter.js
Created June 24, 2022 09:17
Restart Web3TokenCharting on crash
require('dotenv').config();
// initialize mongodb
const Transactions = require('../server/models/history_transactions');
var configDB = require('../server/config/database');
const mongoose = require('mongoose');
console.log( configDB.url )
mongoose.connect(configDB.url, {
@Linch1
Linch1 / calculatePair.js
Created December 22, 2021 12:00
Calculate Pancakeswap Pair Address Offchain
/*
In this script you can undestand how to compute offchain an address of any pancakeswap pair
given the pair tokens
This script can be used also to compute any pancakeswap similar dex like
uniswap ( ethereum )
quickswap ( polygon )
by changing the value of the variables
@Linch1
Linch1 / Pancake Swap Pool Reward Estimator.js
Last active November 8, 2021 03:45
Estimate the rewards from the Cake Manual Pool
let poolAbi = [{"inputs":[{"internalType":"contract CakeToken","name":"_cake","type":"address"},{"internalType":"contract SyrupBar","name":"_syrup","type":"address"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"uint256","name":"_cakePerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"i
@Linch1
Linch1 / Telegram ShitCoin Bot.js
Last active October 4, 2023 12:35
A telegram bot that returns the price of shitcoins ( in BNB )
const TelegramBot = require('node-telegram-bot-api');
let pancakeSwapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalTyp
@Linch1
Linch1 / tokenPriceApi.js
Last active March 17, 2024 08:02
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js