Skip to content

Instantly share code, notes, and snippets.

View etaques's full-sized avatar

Everton H. Taques etaques

View GitHub Profile
@etaques
etaques / tokenPriceApi.js
Created September 18, 2022 14:38 — forked from Linch1/tokenPriceApi.js
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
@etaques
etaques / calculatePair.js
Created September 18, 2022 14:38 — forked from Linch1/calculatePair.js
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
@etaques
etaques / restarter.js
Created September 18, 2022 14:38 — forked from Linch1/restarter.js
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, {
import Web3 from "web3";
import { abi as IUniswapV2Pair } from "@uniswap/v2-core/build/IUniswapV2Pair.json";
import { BigNumber } from "bignumber.js";
import { ChainId, Token, WETH, Fetcher, Route } from "@uniswap/sdk";
// Create a new Web3 Instance
const web3 = new Web3(window.ethereum);
// Replace the addresses to point to your Farming Contract
// and LP Token Contract on the desired network